I have this files path/0.php path/3.php path/2.php path/7.php
I want to display the files with foreach and I use this code:
$files = glob("system/$var/$var/$var/*/*.php");
foreach($files as $file) {
//code here per $file.
//for example:
$basename = basename($file);
echo str_replace(".php",null,$basename) . "<br>";
include $file; //heres i need the path of the files.
}
But I want to sort this files by the largest number that is before the .php extension, like this:
Array
(
[0] => path/7.php
[1] => path/3.php
[2] => path/2.php
[3] => path/0.php
)
so?
update, rsort is not good for me, because the is a path/to/file, before the numbers, i want to use the path of the files.