I have an array with dates from today -> today + 14 days. Structure like this:
Array
(
[0] => Array
(
[0] => Array
(
[datum] => DateTimeImmutable Object
(
[date] => 2019-11-04 16:30:00.000000
[timezone_type] => 1
[timezone] => +01:00
)
)
)
[1] => Array
(
[0] => Array
(
[datum] => DateTimeImmutable Object
(
[date] => 2019-11-05 17:00:00.000000
[timezone_type] => 1
[timezone] => +01:00
)
)
)
)
Now I would like know, which dates are missing.
I try something like this:
for ($i = 0; $i < 14; $i++) {
$checkDate = DateTime::createFromFormat('Y-m-d H:i', date('Y-m-d H:i'))->add(new DateInterval("P".$i."D"));
if(array_search($checkDate, array_column($freeTime, 'datum')) !== false) {
echo "FOUND<br />";
} else {
echo "Not Found<br />";
}
}
But it is only echoing "not found".