Bug #76572 [Opn->Nab]: natsort dash order error
| From: | cmb@php.net | Date: | Tue, 03 Jul 2018 11:42:56 +0000 |
| Subject: | Bug #76572 [Opn->Nab]: natsort dash order error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-216103@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76572&edit=1
ID: 76572
Updated by: cmb@php.net
Reported by: volodymyrbas at gmail dot com
-Summary: nutsort dash order error
+Summary: natsort dash order error
-Status: Open
+Status: Not a bug
Type: Bug
Package: Arrays related
Operating System: Ubuntu 16.04
PHP Version: 7.2.7
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
natcasesort() is about alphanumeric strings; hyphens and underscores,
for instance, are not alphanumeric characters, though. Use usort()
with an appropriate user defined comparison function, if you need it.
Previous Comments:
------------------------------------------------------------------------
[2018-07-03 11:27:22] volodymyrbas at gmail dot com
Description:
------------
nutsort function does not order strings with dash charater in proper order.
Test script:
---------------
<?php
$arr = [
'Saint-Prex',
'Saint Prex',
'Saint Genis Pouilly',
];
natsort($arr);
print_r($arr);
Expected result:
----------------
Array
(
[0] => Saint Genis Pouilly
[2] => Saint Prex
[1] => Saint-Prex
)
Actual result:
--------------
Array
(
[0] => Saint-Prex
[2] => Saint Genis Pouilly
[1] => Saint Prex
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76572&edit=1