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 ($a as $key => $value) { echo "$key: $value\n"; }
based on m8hqK
Output for 5.1.0 - 7.2.0
Notice: Undefined variable: a in /in/EMWAT on line 19 Warning: Invalid argument supplied for foreach() in /in/EMWAT on line 19
Output for 4.3.0 - 4.3.10, 4.4.0 - 5.0.5
Warning: Invalid argument supplied for foreach() in /in/EMWAT on line 19
Output for 4.3.11