I wondered how come that when calling following code the file(name)s in the array are always sorted differently. How does PHP opendir
sort the files and how can I change it in the system without having to put it inside an array first which I then sort?
$dh = opendir($dir);
do {
$files_in_dir[] = $filename;
}
while (false !== ($filename = readdir($dh)));
http://php.net/manual/en/function.readdir.php