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

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

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

elseif/else if

(PHP 4, PHP 5, PHP 7) Examples: elseif, as its name suggests, is a combination of if and else. Like else, it extends an if statement to execute a different statement in case the original if expression evaluates to FALSE. However, unlike else, it will execute that alternative expression only if the elseif conditional expression evaluates to TRUE. For example, the following code would displ

else

(PHP 4, PHP 5, PHP 7) Examples: Often you'd want to execute a statement if a certain condition is met, and a different statement if the condition is not met. This is what else is for. else extends an if statement to execute a statement in case the expression in the if statement evaluates to FALSE. For example, the following code would display a is greater than b if $a is greater than $b,