Edit report at http://bugs.php.net/bug.php?id=6512&edit=1
ID: 6512 Updated by: [email protected] Reported by: [email protected] Summary: sort() Does not sort stings as expected -Status: Analyzed +Status: Bogus Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues Operating System: * PHP Version: 4.0.2 Block user comment: N New Comment: Expected behavior. Previous Comments: ------------------------------------------------------------------------ [2000-09-03 08:35:55] [email protected] OK Chaning to feature/change request and reopening. (The function isnt really misbehaving...) ------------------------------------------------------------------------ [2000-09-03 08:31:45] [email protected] well, natcasesort() does this for natural sorting, but regular/string/numeric sorting can´t be sorted cased... not sure if it should be closed... ------------------------------------------------------------------------ [2000-09-03 08:26:36] [email protected] natcasesort() and natsort() do this, I will add a see also for natcasesort to sort. ------------------------------------------------------------------------ [2000-09-03 07:21:36] [email protected] I´d vote for adding another option to all sorting functions, like SORT_CASED, maybe the bit way asort($x,SORT_STRING|SORT_CASED) ------------------------------------------------------------------------ [2000-09-03 07:12:43] [email protected] When using sort, it sorts by ASCII code and not alphabetically, this might be what was intended but the function does not behave as might be expected, take the following example: <?php $test = array("AA","AC","AR","AJ","Ab"); asort($test); var_dump($test); ?> Does not ourput AA,Ab,AC,AJ,AR But infact AA,AC,AJ,AR,Ab Now this is due to Ascii Char codes. Perhaps a warning should be added to the manual if this behaviour stays the same. James ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=6512&edit=1
