Yeah! You needuksort();
Comparing PHP Sort Functions (helpful lady)
Edit: The reason is that you seem to want to sort inside arrays? AFAIK ksort by itself does not do this - it directly ignores the value of the original array.
Edit2: This should work (although it uses recursion instead of kusort):
function ksort_deep(&$array){
ksort($array);
foreach($array as &$value)
if(is_array($value))
ksort_deep($value);
}
ksort_deep($allowed);
echo '<pre>'.print_r($allowed,true).'</pre>';
: uksort(), , . , :)