I am trying to filter an array to output all the children who will be on holidays within a date range (i.e 14-11-2016 till 18-11-2016) in PHP.
I get the following data in an array and I do not have any control on creation of the data.
[{"holiday":"15-11-2016","name":"Josh Stevens"},{"holiday":"17-11-2016","name":"Josh Stevens"},{"holiday":"22-11-2016","name":"Josh Stevens"},{"holiday":"14-11-2016","name":"Naomi Christ"},{"holiday":"15-11-2016","name":"Naomi Christ"},{"holiday":"16-11-2016","name":"Naomi Christ"},{"holiday":"17-11-2016","name":"Naomi Christ"},{"holiday":"14-11-2016","name":"Jasmine Auger"},{"holiday":"15-11-2016","name":"Jasmine Auger"},{"holiday":"16-11-2016","name":"Jasmine Auger"},{"holiday":"17-11-2016","name":"Jasmine Auger"}]
I need to output data for only the ones whose "holiday" are >= 14-11-2016 and <= 18-11-2016.
I have tried the following logic but it does not return anything
function filterArray($value)
{
  return ($value > '14-11-2016');
}
$filteredArray = array_filter($fullArray, 'filterArray');
foreach($filteredArray as $k => $v)
{
 echo "$k = $v";
}
    
DateTimeclass to parse the date. Afterwards compare theDateTimeobject you previously created so that it belongs on the date range you mentioned.