Chapter 5 _ PHP process control _ PHP Tutorial

Source: Internet
Author: User
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 ++...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.