ID: 38635 Updated by: [EMAIL PROTECTED] Reported By: xconspirisist at gmail dot com -Status: Open +Status: Bogus Bug Type: Documentation problem Operating System: Linux PHP Version: Irrelevant New Comment:
This is definetly the intended resut as all PHP string comparisons are case sensitive (using strcmp() for comparison) and as the lower case letters have higher character codes than the lower case ones (in all common character sets like ASCII, iso-8859-x, Unicode) For case insensitive sorting you need to explicitly specify the comparison function in a user defined sort: <?php $a = array('apples', 'Banannas', 'Carrots' ); usort($a, "strcasecmp"); echo implode($a, ', '); ?> Previous Comments: ------------------------------------------------------------------------ [2006-08-29 00:36:42] xconspirisist at gmail dot com Description: ------------ I assume this is a documentation problem, as I hardly think that this could possibly be the intended output. If you use lower case letters at the beginning of strings that are part of an array, and then use the sort() function on the array, the sort() function will take preference over upper case letters. Reproduce code: --------------- <?php $a = array('apples', 'Banannas', 'Carrots' ); sort($a); echo implode($a, ', '); ?> Expected result: ---------------- apples, Banannas, Carrots Actual result: -------------- Banannas, Carrots, apples ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38635&edit=1