3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = array( '100'=>array('age'=>22,'name'=>'jack','date'=>'2014'), '110'=>array('age'=>23,'name'=>'mary','date'=>'2012'), '120'=>array('age'=>24,'name'=>'lilei','date'=>'2015') ); uasort($arr, function($a1, $b) { if( $a['age'] === $b['age'] ){ return $a['date'] - $b['date']; } return $a['age'] - $b['age']; }); print_r($arr);
based on MRYrt
Output for 7.0.0 - 7.3.0alpha1
Notice: Undefined variable: a in /in/S4XaH on line 10 Notice: Undefined variable: a in /in/S4XaH on line 13 Notice: Undefined variable: a in /in/S4XaH on line 10 Notice: Undefined variable: a in /in/S4XaH on line 13 Array ( [100] => Array ( [age] => 22 [name] => jack [date] => 2014 ) [110] => Array ( [age] => 23 [name] => mary [date] => 2012 ) [120] => Array ( [age] => 24 [name] => lilei [date] => 2015 ) )
Output for 5.3.22 - 5.6.28
Notice: Undefined variable: a in /in/S4XaH on line 10 Notice: Undefined variable: a in /in/S4XaH on line 13 Notice: Undefined variable: a in /in/S4XaH on line 10 Notice: Undefined variable: a in /in/S4XaH on line 13 Array ( [120] => Array ( [age] => 24 [name] => lilei [date] => 2015 ) [110] => Array ( [age] => 23 [name] => mary [date] => 2012 ) [100] => Array ( [age] => 22 [name] => jack [date] => 2014 ) )