<?php
$arrDates = array(
"12/25/2009","01/10/2008","02/12/2000","03/17/1948",
"03/06/1948","11/25/1972","10/23/2009","01/14/2008",
"02/22/2000","03/27/1948","03/16/1948","11/24/1972",
"11/13/2009","11/10/2008","12/12/2000","05/17/1948",
"05/06/1948","10/25/1972","09/23/2009","02/14/2008",
"03/22/2000","04/27/1948","04/16/1948","08/24/1972"
);
/**
* better_cmp()
* @param int $a
* @param int $b
* date comparison callback
**/
function better_cmp($a,$b){
list($a,$b) = [strtotime($a), strtotime($b)];
return ($a <=> $b);
}
usort($arrDates,"better_cmp");
print_r($arrDates);
- 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, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
- Array
(
[0] => 03/06/1948
[1] => 03/16/1948
[2] => 03/17/1948
[3] => 03/27/1948
[4] => 04/16/1948
[5] => 04/27/1948
[6] => 05/06/1948
[7] => 05/17/1948
[8] => 08/24/1972
[9] => 10/25/1972
[10] => 11/24/1972
[11] => 11/25/1972
[12] => 02/12/2000
[13] => 02/22/2000
[14] => 03/22/2000
[15] => 12/12/2000
[16] => 01/10/2008
[17] => 01/14/2008
[18] => 02/14/2008
[19] => 11/10/2008
[20] => 09/23/2009
[21] => 10/23/2009
[22] => 11/13/2009
[23] => 12/25/2009
)
- 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
Array
(
[0] => 03/06/1948
[1] => 03/16/1948
[2] => 03/17/1948
[3] => 03/27/1948
[4] => 04/16/1948
[5] => 04/27/1948
[6] => 05/06/1948
[7] => 05/17/1948
[8] => 08/24/1972
[9] => 10/25/1972
[10] => 11/24/1972
[11] => 11/25/1972
[12] => 02/12/2000
[13] => 02/22/2000
[14] => 03/22/2000
[15] => 12/12/2000
[16] => 01/10/2008
[17] => 01/14/2008
[18] => 02/14/2008
[19] => 11/10/2008
[20] => 09/23/2009
[21] => 10/23/2009
[22] => 11/13/2009
[23] => 12/25/2009
)
- Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.30
- Parse error: syntax error, unexpected '>' in /in/d1Z57 on line 22
Process exited with code 255. - Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
- Parse error: syntax error, unexpected '[' in /in/d1Z57 on line 21
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
- Parse error: parse error, unexpected '[' in /in/d1Z57 on line 21
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error in /in/d1Z57 on line 21
Process exited with code 255.
preferences:
256.7 ms | 401 KiB | 370 Q