i am reading all the files from folder dataand i want to sort them.
$dir = 'data';
$all_files = glob($dir.'/*.*');
asort($all_files);
foreach($all_files as $file) {
echo $file.'<br />';
}
Code above gives me as output:
data/1.txt
data/10.txt
data/11.txt
data/2.txt
data/3.txt
...
How can i sort them so that the output will be:
data/1.txt
data/2.txt
data/3.txt
...
data/10.txt
data/11.txt
sprintf("foo_%06d.txt", 42); // foo_000042.txt