natsort ?

[email protected] (JEFFRY KILLEN)
Newsgroups php.general
Message-ID <[email protected]>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.