function cmp_function($a, $b)
{
if ($a == $b) return 0;
return ($a > $b) ? -1 : 1;
}
$fruits = array("d"=>"lemon", "a"=>"orange", "b"=>"banana" );
usort($fruits, "cmp_function");
Question: What values will be passed for $a and $b parameters for cmp_fucntion()
?
$a
will be first element of two compared at this point, while$b
will be second compared element at this point of sorting algorithm.E.g.: