|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #6512 sort() Does not sort stings as expected
Submitted: 2000-09-03 07:12 UTC Modified: 2010-08-07 01:43 UTC
From: Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.0.2 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2000-09-03 07:12 UTC]
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:

$test = array("AA","AC","AR","AJ","Ab");

Does not ourput


But infact


Now this is due to Ascii Char codes. Perhaps a warning should be added to the manual if this behaviour stays the same.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-09-03 07:21 UTC]

 [2000-09-03 08:26 UTC]
natcasesort() and natsort() do this, I will add a see also for natcasesort to sort.
 [2000-09-03 08:31 UTC]

 [2000-09-03 08:35 UTC]
OK Chaning to feature/change request and reopening. (The function isnt really misbehaving...)
 [2010-08-07 01:43 UTC]
-Status: Analyzed +Status: Bogus -Package: Feature/Change Request +Package: *General Issues
 [2010-08-07 01:43 UTC]
Expected behavior.
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC