Php – Go back at the beginning of a foreach loop in PHP

foreachphp

Is it possible ? Or should I end the loop and beginning another ?

foreach($array as $i)
{
    if (something)
        // Go back
}

Best Solution

It is. But not with foreach & without leaving the loop. Here's another alternative, for good measure.

for ($i = 0; $i < count($array); $i++) {
  if (condition) {
    $i = 0;
  }
  do_stuff_with($array[$i]);
}