3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $myArray = array(); $myArray[]['username'] = 'cpranot'; $myArray[]['username'] = 'lcruz'; $myArray[]['username'] = 'adlee'; //usort($myArray, function($a, $b) { return strnatcmp($a["username"], $b["username"]); }); function something($a, $b){return strnatcmp($a["username"], $b["username"]);} usort($myArray, 'something'); var_dump($myArray);
based on CN7cq
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
array(3) { [0]=> array(1) { ["username"]=> string(5) "adlee" } [1]=> array(1) { ["username"]=> string(7) "cpranot" } [2]=> array(1) { ["username"]=> string(5) "lcruz" } }