note 105456 modified in function.usort by danbrown
| From: | danbrown@php.net | Date: | Sat, 20 Aug 2011 15:59:45 +0000 |
| Subject: | note 105456 modified in function.usort by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-182604@lists.php.net to get a copy of this message | ||
Here is another date sort, in case you have hours and minutes in the dates.
<?php
function DateSort($a,$b,$d="-") {
if ($a == $b) {
return 0;
} else {
$a = strtotime($a);
$b = strtotime($b);
if($a<$b) {
return -1;
} else {
return 1;
}
}
}
?>
--was--
Here is another date sort, in case you have hours and minutes in the dates.
function DateSort($a,$b,$d="-") {
if ($a == $b) {
return 0;
} else {
$a = strtotime($a);
$b = strtotime($b);
if($a<$b) {
return -1;
} else {
return 1;
}
}
}
http://php.net/manual/en/function.usort.php