I have an array with variables like: $shippingtimearr = array("", "1630", "1530", "1530", "1530", "", "");
Each field in this array represents a weekday.
I need to determine how many consecutive fields are empty depending on the day ("starting field").
For example:
If the start is $shippingtimearr[5]
it should return 3
since next "Monday" ($shippingtimearr[0]
) is NULL
.
If the start is an array value that is not NULL
, it should return 0
;
I tried creating a "for" loop like this:
for( $i = 2; $shippingtimearr[$i] = 0; $i++ ) {
$counter++;
}
But it didn't work and obviously, this would not account for the fact that a "week" should be looped again to see if the first days next week are "NULL
".