3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $abc = array( 'a' => array('Aron','M'), 'b' => array('Abbey','D'), 'c' => array('Alice','P')); function cmp($a, $b) { $a=array_pop($a); $b=array_pop($b); $res = strcmp($a,$b); if ( $res == 0) { return 0; } return ($res < 0) ? -1 : 1; } usort($abc, "cmp"); foreach ($abc as $key => $value) { echo "$key: $value\n"; }
based on EMWAT
Output for 5.4.0 - 7.2.0
Notice: Array to string conversion in /in/TFLW6 on line 20 0: Array Notice: Array to string conversion in /in/TFLW6 on line 20 1: Array Notice: Array to string conversion in /in/TFLW6 on line 20 2: Array
Output for 4.3.0 - 5.3.29
0: Array 1: Array 2: Array