Table of Contents

Snippet

each

each

while(list($key, $value) = each($array)){
  ...
}

Array Shift

Loop over an array with a array_shift

while ($page = array_shift($pages)) {
   $page ...
}

Break a while in a switch

while (++$i) {
    switch ($i) {
        case 5:
            break 1;  /* Exit only the switch. */
        case 10:
            break 2;  /* Exit the switch and the while. */
        default:
            break;
    }
}