Jump to: navigation, search

PHP Control Structures

From w3cyberlearnings
# Control Structures Description
1 if if a than go to school.
2 else if morning than go to school, else not go to school.
3 elseif/else if if a than a=2, else if b than a=3, else a=nothing.
4 while while(x is true) than execute some statement.
5 do-while do(something first) while(check expression)
6 for for(expr1;expr2;expr3) statement
7 foreach foreach($arr as $val) statement
8 break end the execution for the current for, foreach, while, do-white, or switch
9 continue use to skip the current loop iteration and continue execute the next condition
10 switch uses to compare the same variable with many different values.
11 declare set execution directives for a block of code.
12 return return something at the end of the current function or statement.
13 require is generate error when required file is not able to include.
14 include similar to require, but will not generate error when the include file is not there.
15 require_once the same as require, but this one called once only
16 include_once the same as include, but it called once only
17 goto jump to a specific section of the program

Related Links

Navigation
Web
SQL
MISC
References