could someone tell me what $b is doing in this example from the manual about usort?
function cmp ($a, $b) {
if ($a == $b) return 0;
return ($a > $b) ? -1 : 1;
}
$a = array (3, 2, 5, 6, 1);
usort ($a, "cmp");
while (list ($key, $value) = each ($a)) {
echo "$key: $value\n";
}
I've only ever seen this explanation or very similar variants of it.
And I STILL don't get it.
Is $b just the other items in the array?
Like if $a was '2', $b would be 3,5,6 and 1 to be checked against $a?
Anyway, I hope someone can help.
Thanks.