3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = array( '56'=>array('class_name'=>'22','name'=>'jack','date'=>'2014'), '61'=>array('class_name'=>'33','name'=>'mary','date'=>'2012'), '57'=>array('class_name'=>'24','name'=>'lilei','date'=>'2015') ); uasort($arr, function($a, $b) { if( $a['class_name'] === $b['class_name'] ){ return $a['date'] - $b['date']; } return $a['class_name'] - $b['class_name']; }); print_r($arr);
based on KsDZb
Output for 5.3.0 - 7.2.0
Array ( [56] => Array ( [class_name] => 22 [name] => jack [date] => 2014 ) [57] => Array ( [class_name] => 24 [name] => lilei [date] => 2015 ) [61] => Array ( [class_name] => 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/KQMGo 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/KQMGo on line 9
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/KQMGo on line 9
Process exited with code 255.