Process control: sequential structure, branch structure (select structure), and cyclic structure. Process control: sequential structure, branch structure (select structure), and cyclic structure.
"; // Iwanghang Android}/** 1.2, bidirectional condition branch structure (else) */if (1 = 1) {echo" iwanghang xixi
"; // Iwanghang xixi} else {echo" iwanghang haha
";} If (1 = 2) {echo" iwanghang 666
";} Else {echo" iwanghang 777
"; // Iwanghang 777}/** 1.3, multi-direction condition branch structure (elseif, switch) */$ a = 1; if ($ a = 3) {echo "iwanghang 333
";} Elseif ($ a = 2) {echo" iwanghang 222
";} Elseif ($ a = 1) {echo" iwanghang 111
"; // Iwanghang 111} else {echo" a is not 1, 2, 3
";} Switch ($ a) {case 3: echo" a = 3
"; Break; case 2: echo" a = 2
"; Break; case 1: echo" a = 1
"; // A = 1 break; default: echo" a is not 1, 2, 3
";}$ B = 33; // Here you can try to assign values 3, 33, and 333 to B. check the printed result switch ($ B) {case 3: case 33: case 333: echo "B meets one of 3, 33, and 333
"; // B meets either of 3, 33, and 333 break; case 2: echo" B = 2
"; Break; case 1: echo" B = 1
"; Break; default: echo" B is not 1, 2, 3
";}/** 1.4, nest condition branch structure */$ name =" iwanghang "; $ sex =" man "; $ age = 18; if ($ sex = "man") {echo "{$ name} is the old man
"; // Iwanghang is old man if ($ age> 60) {echo" {$ name} retired ". ($ age-60)." year
";} Else {echo" {$ name} and ". (60-$ age)." retired
"; // Iwanghang still has 42 years of retirement} else {echo" {$ name} is a veteran
";}
The above is the content of PHP Development (10)-process control-PhpStorm for Android programmers. For more information, see PHP Chinese website (www.php1.cn )!