require

(PHP 4, PHP 5, PHP 7)

return

(PHP 4, PHP 5, PHP 7)

declare

(PHP 4, PHP 5, PHP 7) Examples: The declare construct is used to set execution directives for a block of code. The syntax of declare is similar to the syntax of other flow control constructs: declare (directive) statement As directives are handled as the file is being compiled, only literals may be given as directive values. Variables and constants cannot

switch

(PHP 4, PHP 5, PHP 7) Examples: switch structure The following two examples are two different ways to write the same thing, one using a series of if and elseif statements, and the other using the switch statement: <?php if ($i == 0) {     echo "i equals 0"; } elseif ($i == 1) {     echo "i equals 1"; } elseif ($i == 2) {     echo "i equals 2"; } switch ($i) {     case 0:         ech

continue

(PHP 4, PHP 5, PHP 7) Examples: continue is used within looping structures to skip the rest of the current loop iteration and continue execution at the condition evaluation and then the beginning of the next iteration. Note: In PHP the switch statement is considered a looping structure for the purposes of continue. continue behaves like break (when no arguments are passed). If a switch

break

(PHP 4, PHP 5, PHP 7) Examples: break ends execution of the current for, foreach, while, do-while or switch structure. break accepts an optional numeric argument which tells it how many nested enclosing structures are to be broken out of. The default value is 1, only the immediate enclosing structure is broken out of. <?php $arr = array('one', 'two', 'three', 'four', 'stop', 'five

foreach

(PHP 4, PHP 5, PHP 7) Examples: The foreach construct provides an easy way to iterate over arrays. foreach works only on arrays and objects, and will issue an error when you try to use it on a variable with a different data type or an uninitialized variable. There are two syntaxes: foreach (array_expression as $value) statement foreach (array_expression as $key => $value) st

for

(PHP 4, PHP 5, PHP 7) Examples: for loops are the most complex loops in PHP. They behave like their C counterparts. The syntax of a for loop is: for (expr1; expr2; expr3) statement The first expression (expr1) is evaluated (executed) once unconditionally at the beginning of the loop. In the beginning of each iteration, expr2 is evaluated. If it evaluate

do-while

(PHP 4, PHP 5, PHP 7) Examples: do-while loops are very similar to while loops, except the truth expression is checked at the end of each iteration instead of in the beginning. The main difference from regular while loops is that the first iteration of a do-while loop is guaranteed to run (the truth expression is only checked at the end of the iteration), whereas it may not necessarily ru

while

(PHP 4, PHP 5, PHP 7) Examples: while loops are the simplest type of loop in PHP. They behave just like their C counterparts. The basic form of a while statement is: while (expr) statement The meaning of a while statement is simple. It tells PHP to execute the nested statement(s) repeatedly, as long as the while expression evaluates to TRUE. The value of