xxxxxxxxxx
foreach ($array as $item) {
if ($condition) {
// Skip this iteration and move to the next one
continue;
}
// Perform some actions on $item if the condition is not met
// ...
}
xxxxxxxxxx
<?php
for($i=0;$i<10;$i++)
{
if($i==3)
{
continue; //it will break one iteration.
}
echo $i;
}
?>
xxxxxxxxxx
<?php
foreach ($arr as $key => $value) {
if (!($key % 2)) { // évite les membres pairs
continue;
}
do_something_odd($value);
}
$i = 0;
while ($i++ < 5) {
echo "Dehors<br />\n";
while (1) {
echo "Milieu<br />\n";
while (1) {
echo "Intérieur<br />\n";
continue 3;
}
echo "Ceci n'est jamais atteint.<br />\n";
}
echo "Ceci non plus.<br />\n";
}
?>