Does returning “-1” with usort really move the $b variable or does it keep it in the same place?
问题 A simple piece of code written by me: <?php function testing($a,$b){ if ($a < $b ){ return -1; } elseif ($a > $b){ return 1; } //else { //return 0; //} } $array = array(1,3,2,4,5); usort($array, "testing"); var_dump($array); ?> This is from the top comment (highest rated comment and from 5 years ago) on the php.net manual's usort page: "If you return -1 that moves the $b variable down the array, return 1 moves $b up the array and return 0 keeps $b in the same place." As far as I was looking