PHP 4.0 Bug #5722: sort fails
| From: | biancardi at bware dot it | Date: | Fri, 21 Jul 2000 14:05:45 +0000 |
| Subject: | PHP 4.0 Bug #5722: sort fails | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-25352@lists.php.net to get a copy of this message | ||
From: biancardi@bware.it
Operating system: SunOS sundev 5.7 Generic_106541-02 sun4u sparc
SUNW,Ultra-5_10
PHP version: 4.0.1pl2
PHP Bug Type: Scripting Engine problem
Bug description: sort fails
sort() sorts strings numerically. The following program
behaves differently on php4 (solaris) and php3 (linux):
<?
$a = array("0", "1", "2", "01", "02",
"03", "23","044");
sort($a);
while (list ($key, $value) = each ($a)) {
echo "$key: $value\n";
}
?>
php4.0.1.pl1 (on Solaris) results:
0: 0
1: 1
2: 01
3: 2
4: 02
5: 03
6: 23
7: 044
php3 (on Linux) results:
0: 0
1: 01
2: 02
3: 03
4: 044
5: 1
6: 2
7: 23