Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

While

While is a loop structure. It runs the block of code until the condition is not met anymore.

Part of the loop execution may be skipped by using the continue keyword.

<?php

/*
while(condition) {
    // the block
}
*/

$i = 0;
while($i < 10) {
    print "$i\n";
}

?>

Documentation

See Also