I have an array of this form:
Array ( [first_level] => Array ( [dir_3] => Array ( [subdir_1
Use a recursive function:
// Note this method returns a boolean and not the array function recur_ksort(&$array) { foreach ($array as &$value) { if (is_array($value)) recur_ksort($value); } return ksort($array); }