PHP 4.0 Bug #5730: sort and rsort are not 'opposites'
| From: | the_jalal at yahoo dot com | Date: | Fri, 21 Jul 2000 22:35:38 +0000 |
| Subject: | PHP 4.0 Bug #5730: sort and rsort are not 'opposites' | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-25393@lists.php.net to get a copy of this message | ||
From: the_jalal@yahoo.com
Operating system: Linux 2.3 SuSE 6.3
PHP version: 4.0.0
PHP Bug Type: Scripting Engine problem
Bug description: sort and rsort are not 'opposites'
sort an array and rsort an array should give the same order in reverse, the following does not:
------------
$a = array("0", "1", "01", "2");
sort($a);
while (list ($key, $value) = each ($a)) {
echo "$key: $value\n";
}
echo "\n";
$a = array("0", "1", "01", "2");
rsort($a);
while (list ($key, $value) = each ($a)) {
echo "$key: $value\n";
}
------------
gives the results:
0: 0
1: 01
2: 1
3: 2
0: 2
1: 01
2: 1
3: 0