It is possible to use break/continue in 2 loops without variable ? (no continue 2; or break 2;)
Example doesn't work :
while(1) {
// some code
while(2) {
// some code
if(expr) {
break; // break while(2)
continue; // continue while(1) but never used
}
// some code
}
// some code
}
Solution with variable :
while(1) {
// some code
$continue = false;
while(2) {
// some code
if(expr) {
$continue = true;
break;
}
// some code
}
if($continue) {
continue;
}
// some code
}
Any solution with break / continue in the while(2) loop ? Another best way ?
Edit. Exemple with datas :
for($i=0; $i < 100; $i++) {
$a = mt_rand(0, 1000);
for($j=0; $j < 100; $j++) {
if($j === $a) {
break; // and continue the first loop
}
}
echo "how to never display this string if second loop break?";
}