Today's Lesson: PHP 3-Day Foundation Consolidation video Tutorial "Yan 18"
1, Increment decrement operator//first operation in output
$b = 5; $a = $b ++;var_dump ($a, $b);//5,6 echo ' <br/> '; $b = 5; $a = $b--;var_dump ($a, $b);//5,4echo ' <br/> '; $b = 5; $a = + + $b; Var_dump ($a, $b);//6,6. 1: Put the value of B +1,2: Return the new value echo ' <br/> '; $b = 5; $a =--$b; Var_dump ($a, $b);//
2, the string operator//.
echo ' <br/> '; $a = ' hello '; $b = ' word '; $c = $a. $b, Var_dump ($c), echo ' <br/> ', $d = $c = $c. $d; Var_dump ($c); The following speed is fast echo ' <br/> '; $a = ' hello '; $b = ' word '; echo $a, $b;//arithmetic faster echo $a. $b;
3. Assignment operators
echo ' <br/> '; $a = 3;//assignment operation, 1: Assignment to $a,2: return operation result $res = ($a = 3); Var_dump ($res);
4, switch cash control structure//swich case is suitable for validating multiple possible values, not applicable to the range of judgments, such as 60-80 of several. 80-100 Excellent
echo ' <br/> '; $tody = = 1;if ($tody = 1) {echo "Today is Week 1";} else if ($today = = 2) {echo "Today is Week 2";} else if ($today = = 3) {echo "Today is Week 3";} else if ($today = = 4) {echo "Today is Week 4";} else if ($today = = 5) {echo "Today is Week 5";} else if ($today = = 6) {echo "Today is Week 6";} else if ($today = = 7) {echo "Today is Week 7";} else {echo "You are from Mars";} echo ' <br/> '; $today = 3; Switch ($today) {case 1:echo "today is Week 1"; Break;case 2:echo "Today is Week 2"; Break;case 3:echo "Today is Week 3"; Break;case 4:echo "Today is Week 4" ; Break;case 5:echo "Today is Week 5", Break;case 6:echo "Today is Week 6"; Break;case 7:echo "Today is Week 7"; Break;default:echo "You Are from Mars";}
5. While loop, do while (always executes once)
echo ' <br/> '; $i = 0;while ($i <=) {echo $i + +, ' <br/> ';} $i = 100;do {echo $i + +. ' <br/> ';} while ($i <=); Echo ' <br/> ';
Weekend to play, yesterday very tired, today continue to work to give up, the fifth day ~ ~
This article from "A Big big waste fish" blog, declined reprint!
Abandoned fish--how long does PHP take to get from getting started to giving up? 5