Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
recursive ksort function for PHP
ksortRecursive(&$array, $sort_flags = SORT_REGULAR) {
if (!is_array($array)) return false;
ksort($array, $sort_flags);
foreach ($array as &$arr) {
ksortRecursive($arr, $sort_flags);
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment