3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $test = array( "texas" => array( "withers field B" => array("name" => "beam pump 3"), "z should go second" => array("name" => "beam pump 2"), "a should go first" => array("name" =>"beam pump 1") ) ); function multiLevelSort($arr) { if (is_array($arr)) { ksort($arr); foreach($arr as $value) { $value = multiLevelSort($value); } } return $arr; } echo("hello"); $test = multiLevelSort($test); echo(var_dump($test)); ?>
based on bKTJ8
Output for 4.3.0 - 7.2.0
helloarray(1) { ["texas"]=> array(3) { ["withers field B"]=> array(1) { ["name"]=> string(11) "beam pump 3" } ["z should go second"]=> array(1) { ["name"]=> string(11) "beam pump 2" } ["a should go first"]=> array(1) { ["name"]=> string(11) "beam pump 1" } } }