natsort ?
| From: | JEFFRY KILLEN | Date: | Sun, 22 May 2022 16:00:58 +0000 |
| Subject: | natsort ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-327990@lists.php.net to get a copy of this message | ||
Hello:
I am trying to get an array sorted naturally.
I do something like
$list = scandir($dirname);
natsort($list);
According to the manual page the array values are sorted but
the keys remain the same. So running the array through a loop
does not produce the sorted order. I produces the original order.
How to I get a sorted version of the array that I can loop through
and produce the revised order?
journal-1.2020.php
journal-10.2020.php
journal-11.2020.php
journal-12.2020.php
journal-2.2020.php
journal-3.2020.php
journal-4.2020.php
journal-5.2020.php
journal-6.2020.php
journal-7.2020.php
journal-8.2020.php
journal-9.2020.php
Thank you for time and attention
Jeff K.