i have this code to find 3 consecutive dates in an array but i'm wondering if there is a better way to do this?
php code:
$datesarray = array('2012-10-01', '2012-10-03', '2012-10-04', '2012-10-05', '2012-10-08', '2012-10-09');
$count = 0;
$result = "Nothing found";
foreach ($datesarray as $value) {
if(strtotime($datesarray[$count]) - strtotime($datesarray[$count-1]) - strtotime($datesarray[$count-2]) == -1349150400) {
$result = "3 Consecutive dates found";
}
$count++;
}
echo "Result: $result";