发布网友 发布时间:2022-04-06 10:10
共3个回答
热心网友 时间:2022-04-06 11:40
可以将多个数值放到一个数组里,用sork()函数对其进行排序,然后再用foreach输出。追答 1, "name" => "Boney M", "rating" => 3),
array("id" => 2, "name" => "Take That", "rating" => 1),
array("id" => 3, "name" => "The Killers", "rating" => 4),
array("id" => 4, "name" => "Lusain", "rating" => 3),
);
foreach ($data as $key => $value) {
$rating[$key] = $value['rating'];
}
array_multisort($rating, SORT_ASC, $data);
foreach ($data as $key => $value) {
echo $value['id'];
echo $value['name'];
echo $value['rating'];
echo "";
}
?>
从小到大排序,希望对你有帮助
热心网友 时间:2022-04-06 12:58
加入一个数组,然后使用数组排序函数追问我想进行复杂的参数排序,由于追问*字数,我给重新写了一个问题。。。http://zhidao.baidu.com/question/368845963.html?oldq=1
热心网友 时间:2022-04-06 14:32
<?php