I have an array of dates formatted in 'm/d/Y' (month/day/year):
$array = array(
'1/10/2014',
'1/11/2014',
'1/12/2014',
'1/13/2014',
'1/14/2014'
);
and I'd like to output the array with only dates of today or in the future. So if today is 1/12/2014 it would eliminate the 1/10/2014 and 1/11/2014.
Here is what I have that isn't working:
foreach ($array as $date) {
$unixdate = strtotime($date);
if ($unixdate < time()) {
unset($array[$date]);
}
}
print_r($array);
I guess I'm not using unset correctly because it prints the entire array?