-1
我需要數組排序,使被分等級,但我不能讓它正常工作數組..排序使用「點」
function cmp($a, $b)
{
return strcmp($a->points, $b->points);
}
usort($teamList, "cmp");
foreach($teamList as $r)
{
echo $r->name . " " . $r->points. "<br>";
}
我此代碼得到這個: randomteam * -100 randomteam * -12 randomteam * -12.5 randomteam * -15 randomteam * -15.5 randomteam * -15.5
- 每個randomteam是一支不同的球隊
請提供一個數組例子 – user4035