Chapter 5-PHP process control. 1. ordered Structure 2. branch structure 2.1if..else? (W); (0 Sunday !} Sorry !? 2.2if..elseif2.3switch3. loop structure 3.1 while? 1 (100. ++? 3.2do..while and CC + 1. sequential structure
2. branch structure
2.1 if... else
2.2 if... elseif
2.3 switch
3. loop structure
3.1 while
3.2 do... while
Similar to C/C ++
3.3
'(= 0; <; + []. ''?>
3.4Foreach
The foreach statement is used to traverse arrays. There are two syntax formats:
① Foreach (array name as element name ){
Statement block;
}
② Foreach (array name as key name => element name ){
Statement block;
}
The former example is as follows:
'(. ''?>
Examples of the latter are as follows:
'Sunday', 'Monday' => 'Monday', 'Tuesday' => 'Tuesday', 'Wednesday', 'Thursday' => 'Thursday ', 'Friday' => 'Friday', 'Saturday' => 'Saturday' = ('Array size '..''(=>.': '...'?>
4. break and continue
The break can be followed by a number, indicating that the number of repeated loops is exceeded, and the continue can be followed by a number, indicating that the statements that have not been executed after the number of repeated loops are exceeded.
Limit 2. branch structure 2.1 if... else? = ("W"); (= 0 'Sunday! '}' Sorry! '? 2.2 if... elseif 2.3 switch 3. loop structure 3.1 while? = 1 (= 100. ''+ +? 3.2 do... while and C/C ++...