3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = [ 1 => [ 'Date' => 2015-11-04 ], 2 => [ 'Date' => 2015-11-05 ] ]; uksort($arr,'mySortDate'); function mySortDate($a,$b) { $aDate = strtotime($a['Date']); $bDate = strtotime($b['Date']); if ($aDate == $bDate) { return 0; } return ($aDate < $bDate) ? -1 : 1; } print "<pre>"; var_dump($arr);
based on 8ERbu
Output for 7.0.0 - 7.2.0
<pre>array(2) { [1]=> array(1) { ["Date"]=> int(2000) } [2]=> array(1) { ["Date"]=> int(1999) } }
Output for 5.4.12 - 5.6.28
<pre>array(2) { [2]=> array(1) { ["Date"]=> int(1999) } [1]=> array(1) { ["Date"]=> int(2000) } }
Output for 5.3.22 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/99VHb on line 2
Process exited with code 255.