>if-else

>>if 语句

if (条件){条件为true执行代码}

>>if-else

if (条件){条件为true执行代码}

else{条件为false执行代码}

>>if-elseif-else

if (条件){条件为true执行代码}

elseif (条件){条件为true时执行代码}

else{条件为false执行代码}

>switch语句

>>switch(expression){

case label1: execute code;break;

case label2:execute code;break;

default: execute code;break;

}

>循环

>>while(condition){coding;} 指定条件为真,执行代码块;

>>do {coding} while{condition}执行到条件为假

>>for (init counter; test counter; increment counter){coding}同C++

>>foreach ($array as $value){遍历数组中的每一个键}同python