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'=>33,'name'=>'mary','date'=>'2012'), '120'=>array('age'=>24,'name'=>'lilei','date'=>'2015') ); uasort($arr, function($a, $b) { if( $a['age'] === $b['age'] ){ return $a['date'] - $b['date']; } return $a['age'] - $b['age']; }); print_r($arr);
based on MRYrt
Output for 5.3.0 - 7.2.0
Array ( [100] => Array ( [age] => 22 [name] => jack [date] => 2014 ) [120] => Array ( [age] => 24 [name] => lilei [date] => 2015 ) [110] => Array ( [age] => 33 [name] => mary [date] => 2012 ) )
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/NmFYX on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/NmFYX on line 9
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/NmFYX on line 9
Process exited with code 255.