ID: 19795 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Feedback Bug Type: Strings related Operating System: FreeBSD 4.6 PHP Version: 4.2.2 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php4-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-latest.zip Previous Comments: ------------------------------------------------------------------------ [2002-10-07 06:00:21] [EMAIL PROTECTED] I am quite sure I did that yes. I set locale for LC_ALL and strftime is working as it should. If I understand the documentation correctly, this function should work as strcmp except for the fact that numbers are sorted in a natural order. And strcmp does sort as I expect. usort using strcmp: array(11) { [0]=> string(1) "1" [1]=> int(1) [2]=> string(2) "12" [3]=> string(1) "2" [4]=> string(1) "a" [5]=> string(1) "z" [6]=> string(1) "�" [7]=> string(1) "�" [8]=> string(1) "�" [9]=> string(1) "�" [10]=> string(1) "�" } using strnatcmp: array(11) { [0]=> string(1) "�" [1]=> string(1) "�" [2]=> string(1) "�" [3]=> string(1) "�" [4]=> string(1) "�" [5]=> string(1) "1" [6]=> int(1) [7]=> string(1) "2" [8]=> string(2) "12" [9]=> string(1) "a" [10]=> string(1) "z" } ------------------------------------------------------------------------ [2002-10-07 03:58:36] [EMAIL PROTECTED] Did you set-up your locales correctly? Derick ------------------------------------------------------------------------ [2002-10-07 03:51:15] [EMAIL PROTECTED] Characters with an ASCII value above 127 is considered to be the lower value. This is a bit unfortunate if you use a language with special characters (like the 3 danish letters after z in the list below). $list = array('a', 1, '2', '12', '1', 'z', '�', '�', '�', chr(137), chr(128)); usort($list, 'strnatcmp'); var_dump($list); The values above 127 are sorted correctly, they should just be considered higher than A-z. I believe I have seen this bug on a Solaris Unix as well. But that was a while ago and I can not provide any detailed information on that situation. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19795&edit=1
