In the function below, I'm seeing to sort the array by alpha. However, it returns bool(true) rather than the actual sorted array. What am I missing?
function get_dirs($dir) {
$array = array();
$d = dir($dir);
while (false !== ($entry = $d->read())){
if($entry!='.' && $entry!='..') {
$entry2 = $dir."/".$entry;
if(is_dir($entry2)) {
$array[] = $entry;
}
}
}
$d->close();
//return $array; THIS WORKS FINE BUT UNSORTED
return natcasesort($array); //THIS RETURNS A BOOLEAN?
}