3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array( array("5","3","21"), array("0.5","3","may"), array("2.2","3","sport"), ); //print_r($array); function subval_sort($a,$subkey) { foreach($a as $k=>$v) { $b[$k] = strtolower($v[$subkey]); } asort($b); foreach($b as $key=>$val) { $c[] = $a[$key]; } return $c; } $result = subval_sort($array, 0); print_r($result);
based on p6k8S
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => Array ( [0] => 0.5 [1] => 3 [2] => may ) [1] => Array ( [0] => 2.2 [1] => 3 [2] => sport ) [2] => Array ( [0] => 5 [1] => 3 [2] => 21 ) )