|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67831 Wrong sorting array
Submitted: 2014-08-12 16:54 UTC Modified: 2014-12-30 10:42 UTC
From: fotlax at qip dot ru Assigned:
Status: No Feedback Package: Arrays related
PHP Version: 5.6.0RC3 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
44 + 15 = ?
Subscribe to this entry?

 [2014-08-12 16:54 UTC] fotlax at qip dot ru
Wrong sorting Array when sort_flags = SORT_NATURAL.

Test script:


print_r($a); # Sort OK
print_r($b); # Sort Wrong - Why? Bug?

Expected result:
    [0] => W108
    [1] => W109
    [2] => W1010
    [3] => W1011

    [0] => W0010
    [1] => W0011
    [2] => W008
    [3] => W009


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-08-13 07:41 UTC]
-Status: Open +Status: Feedback
 [2014-08-13 07:41 UTC]
Could you please elaborate on your
- Operating sustem
- configure line
- actual output

because on my 5.6.0RC3 on Ubuntu 12.04 I get exactly your expected result.
Should you be talking about the leading zeroes, the natsort() manual page says:

5.2.10	 Zero padded numeric strings (e.g., '00005') now essentially ignore the 0 padding.

and SORT_NATURAL references natsort()
 [2014-12-30 10:42 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 14 03:01:32 2024 UTC