note 88887 deleted from function.uksort by danbrown
| From: | danbrown@php.net | Date: | Thu, 12 Feb 2009 22:31:17 +0000 |
| Subject: | note 88887 deleted from function.uksort by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-150597@lists.php.net to get a copy of this message | ||
Note Submitter: dead dot screamer at seznam dot cz
----
user sorting functions are working very odd and unpredictably, when compare function return 0.
In this situation is array sorted randomly.
example:
<?php
$array=range(1,10);
var_Dump($array);
uKSort($array,create_Function('$a, $b','return 0;'));
var_Dump($array);
?>
output:
array(10) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
[3]=>
int(4)
[4]=>
int(5)
[5]=>
int(6)
[6]=>
int(7)
[7]=>
int(8)
[8]=>
int(9)
[9]=>
int(10)
}
array(10) {
[6]=>
int(7)
[7]=>
int(8)
[8]=>
int(9)
[9]=>
int(10)
[5]=>
int(6)
[4]=>
int(5)
[1]=>
int(2)
[2]=>
int(3)
[3]=>
int(4)
[0]=>
int(1)
}