Originariamente inviato da badaze
Con il tuo esempio il 10/02/2004 non è superiore al 11/02/2003.
Due date possono essere confrontate solo se hanno un formato ssaammgg.
quind così dovrebbe andare?
codice:
function test($start, $end) {
list($day, $month, $year) = explode("/", $start);
$start = $year.$month.$day;
list($day, $month, $year) = explode("/", $end);
$end = $year.$month.$day;
return $end > $start ? true : false;
}
$data_start = "11/02/2003";
$data_end = "10/02/2004";
echo $data_end.(test($data_start, $data_end) ? " > " : " <= ").$data_start;