- uksort: documentation ( source)
<?php
$a = ['foo-test' => [1], '-' => [2], 'bar-test' => [3]];
uksort($a, function($x, $y) use (&$a) {
if (!isset($a[$x])) {
throw new Exception("Key '{$x}' not found.");
}
if (!isset($a[$y])) {
throw new Exception("Key '{$y}' not found.");
}
return $x < $y;
});