Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites
All the assignment operators put a value into a variable. Specifically, they put a value on the right side into a variable on th ...
Listing 2.12 String/Number Conversion <? //1 + 1 == 2 print((1 + "1"). "\n"); //1 + 2 == 3 print((1 + " 2"). "\n"); //1 + 3 = ...
<< >>^ < > <= >=^ == !=^ &^ ^^ |^ &&^ ||^ ?:^ = += -= *= /= &= |= ^= .= <<= >&g ...
Chapter 3. CONTROL STATEMENTS Control statements allow you to execute blocks of code depending on conditions. They also allow yo ...
code in the greater if statement is skipped. That is to say, only one match will be made. Listing 3.1 demonstrates an if-elseif- ...
Listing 3.3 Covering All Cases with if-elseif-else ...
...
...
The conditional expression is evaluated to be either true or false. If true, the expression between the question mark and the co ...
Figure 3-3. The switch statement. The root expression inside a switch statement is evaluated and then compared to each expressio ...
$deutsch_Day = "Donnerstag"; break; case "Friday": $deutsch_Day = "Freitag"; break; case "Saturday": $deutsch_Day = "Samstag"; b ...
The while loop in Listing 3.5 tests that the date stored in currentDate is not a Friday. If it is, then the loop will be finishe ...
Again the current date is tested for being a Friday. Eventually, currentDate will be a Friday and the loop will end. But what if ...
true. The result is a loop that goes on forever. I might as well write it as while(true) and make it very clear. When a loop con ...
...
...
The do...while Statement You can delay the decision to continue executing a loop until the end by using a do...while statement. ...
The problem is that it is very easy to forget to put the increment in. The result is an infinite loop. The for loop puts all thi ...
Most for loops look like Listing 3.9. They use a counter that increments by one each time through the loop. However, the for sta ...
<? /* print some text explaining the output / print("Days left before Friday:\n"); print("\n"); for($currentDate = date("U") ...
«
1
2
3
4
5
6
7
8
9
10
»
Free download pdf