So I been having this issue that I been trying to solve for a while, the issue is that I have an array
$time=array("10:00 AM","11:00 AM","12:00 PM","1:00 PM","2:00 PM","3:00 PM","4:00 PM","5:00 PM");
and the problem is that I'm trying to u take off the variables of the array if the time now is grater than the value in the array then take off the value from the array else just leave it in there and move on to the next position
This is what I have tried so far
$tz_object = new DateTimeZone('America/New_York');
$datetime = new DateTime();
$datetime->setTimezone($tz_object);
$datetime->format('g:i A');
$i=0;
while($i<= count($time)){
if ($datetime> '12:00 PM') {
echo "take off time from the array";
}
$i++;
}
I should end up with a result like this in my array
$time=array("1:00 PM","2:00 PM","3:00 PM","4:00 PM","5:00 PM");