in reply to Re^6: foreach argument modification inside loop, followed by return from loop
in thread foreach argument modification inside loop, followed by return from loop
As far as I can tell, you only ever look at the first element of the jobs array;
No, first job can return 'wait' and loop will jump next job after this line
return 'wait' unless --$maxcnt;
I see you're correct; as I mentioned, I only had time for a brief look so I could offer up some (illustrative) feedback on how you might approach your question of "Problem that I mentioned in my posting, followed by return from loop that "for" loop is in get_task(). i.e. there is another outer "for" loop.".
In any case, if you like, you can still use similar logic by shifting in a while loop, since you consume the element every time, and the shift of course doesn't care about changes from one loop iteration to the next.
Certainly, there are ways to make it bit better. But I actually think it's irrelevant to this topic :)
Ah, perhaps I've over-stayed my helpfulness. :-) Good luck! :-)