Hi,
This question might sound pretty complicated so please let me know if you need me to re-word it.
I have a list of folders in a directory which I want sorted by number of hits. I found a simple PHP hit counter which stores the number of hits in a file (hits.txt) for each folder.
So, my question is, how can I sort the list of folders by the number in each text file, from highest to lowest?
Here is my code so far - this sorts the list by date modified:
<?php
function listByDate(){
$path = glob("*",GLOB_ONLYDIR); //the double \\ is not a typo you
//have to escape it
//if the path cannot be found
if(!($path)){
echo("The specified path could not be found.");
return;
}//if
//the path is valid
else{
array_multisort(
array_map( 'filemtime', $path ),
SORT_NUMERIC,
SORT_DESC,
$path
);
foreach($path as $i){
echo("<a href='$i'>");
echo $i;
echo("</a><br>");
}//foreach
}//else
}//populateDropdown
?>
Thanks in advance, and again, sorry if this question is too complicated - feel free to ask me to re-word it.