3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $map = array(array('-1'=>0, '-10'=>0, '-100'=>0), array(array('-1'=>0, '-10'=>0, '-100'=>0))); function ksort_recursive($array){ if (is_array($array)) { ksort($array); foreach ($array as $k => $v) { $array[$k] = call_user_func(__FUNCTION__, $v); } } return $array; } $map = ksort_recursive($map); // ksort($map[0]); // ksort($map[0]); // ksort($map[0]); // ksort($map[1][0]); // ksort($map[1][0]); // ksort($map[1][0]); print_r($map);
based on jng0o
Output for 4.3.0 - 7.2.0
Array ( [0] => Array ( [-100] => 0 [-10] => 0 [-1] => 0 ) [1] => Array ( [0] => Array ( [-100] => 0 [-10] => 0 [-1] => 0 ) ) )