Answer the question
In order to leave comments, you need to log in
How to determine the first and last date in an array in php?
Tried to compare:
$start = '0000-00-00';
$end = '0000-00-00';
if ($date > $start) {
$start = $date;
}
if ($date < $end) {
$end = $date;
}
Answer the question
In order to leave comments, you need to log in
$start = '9999-99-99';
$end = '0000-00-00';
foreach ($dates as $date) {
if ($date < $start) {
$start = $date;
}
if ($date > $end) {
$end = $date;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question