How to sort based on score in PHP
袁郡
袁郡 2021-05-01 17:01:52
0
1
888

By looping through values, the name is obtained in $name['name']; $staff_n obtains the total score of the corresponding name;

$hbsz=array($name['name'], $staff_n);

Now output this $hbsz array var_dump($hbsz); The result is as follows;

array (size=2)

0 => string ' Yuan Yunzhong' (length=6) 1 => float 5250array (size=2) 0 => string 'Li Siyuan' (length=9) 1 => float 11000array (size=2) 0 => string 'Zhang Songtao' (length=9) 1 => float 750

Could you please give me some advice on how to sort the output results from high to low according to the scores?

That is

array (size=2) 0 => string 'Li Siyuan' (length=9) 1 => float 11000

Ranked first

袁郡
袁郡

reply all(1)
不喜欢吃糖

Use rsort

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template