Hello John,
Tuesday, July 27, 2004, 9:48:28 PM, you wrote:
> Consider the following:
> <?php $a = array('a', 'b', 'c', 'a'=>0, 'b'=>1, 'c'=>2);
> sort($a);
> print_r($a);
?>>
> This produces a bogus output:
> Array
> (
> [0] => a
> [1] => b
> [2] => 0
> [3] => c
> [4] => 1
> [5] => 2
> )
> Notice how 0 and c are switched incorrectly. Attached is a patch to
> zend_operators.c that fixes it.
The current order simply makes no sense at all.ŽThe following though would:
0 a b c 1 2 // zero dirst, then strings then numbers
a b c 0 1 2 // strings first, then numbers
0 1 2 a b c // numbers first, then strings
and btw, john you forgot the patch, it is attached here.
The one provided does the 2nd which means we only ensured
0 is treated un the same way other numbers are.
Best regards,
Marcus mailto:helly@php.net