I’m using PHP’s foreach(), Sometimes when the inner code doesn’t do what i want, I’d like to re-try the same level instead of continuing to the next one.
Is that possible?
Example:
foreach($pics AS $pic){
if(!upload($pic)){
again; // something like this
}
}
No but you can put a while loop inside your loop, this has equivalent behaviour as what you desire above. However you should modify it to use a counter and stop after X many retries to prevent infinite looping.