I have an array that I need to continuously loop through until I get my outcome and then I will break the loop. I need to be able to start at a certain point of the array based on value of the string in the array.
Lets say I want to start on friday, then the continuous loop would start on friday and go from there before it stars over.
friday //start here
saturday
sunday
monday
tuesday
wednesday
thursday
friday
...and so on
My Code
$array = array('monday','tuesday','wednesday','thursday','friday','saturday','sunday');
$infinate = new InfiniteIterator(new ArrayIterator($array));
foreach ($infinate as $key => $value) {
//check stuff until I break the loop
}
Is this possible?