Is possible in php to reset The foreach?
for example:
foreach($rows as $row)
{
if(something true)
{
continue foreach;
}
else
{
break;
reset foreach;//I mean start foreach again...
}
}
----------------------------------Edited
Thanks my friend for your answers...
The condition generate from result of foreach so I can not use function. I wana sortet it by (fro example) alphabet...in many DIV html. I can not filter result by SQL for same reson.
So mybe I have to use a css trick.
You could do something around these lines (and avoid the limitations of recursion):
while (True) {
$reset = False;
foreach ($rows as $row) {
if(something true) {
continue;
} else {
$reset = True;
break;
}
}
if ( ! $reset ) {
break; # break out of the while(true)
}
# otherwise the foreach loop is `reset`
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With