3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Output for 8.3.0 - 8.3.4, 8.3.6
Warning: Trying to access array offset on int in /in/99VHb on line 17 Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/99VHb on line 17 Warning: Trying to access array offset on int in /in/99VHb on line 18 Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/99VHb on line 18 <pre>array(2) { [1]=> array(1) { ["Date"]=> int(2000) } [2]=> array(1) { ["Date"]=> int(1999) } }
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Warning: Trying to access array offset on int in /in/99VHb on line 17 Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/99VHb on line 17 Warning: Trying to access array offset on int in /in/99VHb on line 18 Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/99VHb on line 18 <pre>array(2) { [1]=> array(1) { ["Date"]=> int(2000) } [2]=> array(1) { ["Date"]=> int(1999) } }
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/99VHb on line 17 Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/99VHb on line 17 Warning: Trying to access array offset on value of type int in /in/99VHb on line 18 Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/99VHb on line 18 <pre>array(2) { [1]=> array(1) { ["Date"]=> int(2000) } [2]=> array(1) { ["Date"]=> int(1999) } }
Output for 8.0.0 - 8.0.30
Warning: Trying to access array offset on value of type int in /in/99VHb on line 17 Warning: Trying to access array offset on value of type int in /in/99VHb on line 18 <pre>array(2) { [1]=> array(1) { ["Date"]=> int(2000) } [2]=> array(1) { ["Date"]=> int(1999) } }
Output for 7.4.0 - 7.4.33
Notice: Trying to access array offset on value of type int in /in/99VHb on line 17 Notice: Trying to access array offset on value of type int in /in/99VHb on line 18 <pre>array(2) { [1]=> array(1) { ["Date"]=> int(2000) } [2]=> array(1) { ["Date"]=> int(1999) } }
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
<pre>array(2) { [1]=> array(1) { ["Date"]=> int(2000) } [2]=> array(1) { ["Date"]=> int(1999) } }
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
<pre>array(2) { [2]=> array(1) { ["Date"]=> int(1999) } [1]=> array(1) { ["Date"]=> int(2000) } }

preferences:
213.22 ms | 402 KiB | 226 Q