3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 1 => [ 'Date' => '2015-11-05' ], 2 => [ 'Date' => '2015-11-11' ] ]; 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);
Output for 8.3.0 - 8.3.6
Warning: Trying to access array offset on int in /in/OtiGc on line 17 Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/OtiGc on line 17 Warning: Trying to access array offset on int in /in/OtiGc on line 18 Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/OtiGc on line 18 <pre>array(2) { [1]=> array(1) { ["Date"]=> string(10) "2015-11-05" } [2]=> array(1) { ["Date"]=> string(10) "2015-11-11" } }
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Warning: Trying to access array offset on value of type int in /in/OtiGc on line 17 Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/OtiGc on line 17 Warning: Trying to access array offset on value of type int in /in/OtiGc on line 18 Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/OtiGc on line 18 <pre>array(2) { [1]=> array(1) { ["Date"]=> string(10) "2015-11-05" } [2]=> array(1) { ["Date"]=> string(10) "2015-11-11" } }
Output for 8.0.0 - 8.0.30
Warning: Trying to access array offset on value of type int in /in/OtiGc on line 17 Warning: Trying to access array offset on value of type int in /in/OtiGc on line 18 <pre>array(2) { [1]=> array(1) { ["Date"]=> string(10) "2015-11-05" } [2]=> array(1) { ["Date"]=> string(10) "2015-11-11" } }
Output for 7.4.0 - 7.4.33
Notice: Trying to access array offset on value of type int in /in/OtiGc on line 17 Notice: Trying to access array offset on value of type int in /in/OtiGc on line 18 <pre>array(2) { [1]=> array(1) { ["Date"]=> string(10) "2015-11-05" } [2]=> array(1) { ["Date"]=> string(10) "2015-11-11" } }
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33
<pre>array(2) { [1]=> array(1) { ["Date"]=> string(10) "2015-11-05" } [2]=> array(1) { ["Date"]=> string(10) "2015-11-11" } }
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.21
<pre>array(2) { [2]=> array(1) { ["Date"]=> string(10) "2015-11-11" } [1]=> array(1) { ["Date"]=> string(10) "2015-11-05" } }

preferences:
163.7 ms | 402 KiB | 182 Q