PHP process control, php process _ PHP Tutorial

Source: Internet
Author: User
Tags sunrise time
PHP process control and php process. PHP process control. The php-if statement of the PHP process is used to execute code only when the specified condition is set. Syntax if (condition) {code to be executed when the condition is set;} if the current time is less than the PHP process control, the php process
PHP-if statement

If statement is usedRun the code only when the specified condition is set..

Syntax

If (condition) {code to be executed when the condition is set ;}

If the current time is less than 20, the following instance will output "Have a good day! ":

Instance

 

Run

PHP-if... else statement

Execute one piece of code when the conditions are met, and execute another piece of code when the conditions are not met., Use the if... else statement.

Syntax

If (condition) {code executed when the condition is set;} else {code executed when the condition is not set ;}

If the current time is less than 20, the following instance will output "Have a good day! ", Otherwise output" Have a good night! ":

 

PHP-if... else statement

Execute a code block when several conditions are created., Use the if... else statement ..

Syntax

If (condition) {code executed when the if condition is set;} else if (condition) {code executed when the elseif condition is set;} else {code executed when the condition is not set ;}

If the current time is less than 10, the following instance will output "Have a good morning! ", If the current time is not less than 10 and less than 20, the output" Have a good day! ", Otherwise output" Have a good night! ":

 

  

Address: http://www.manongjc.com/php/php_if_switch.html

Related reading:

Php date_sunrise () obtains the sunrise time based on the location (longitude and latitude)

Php global legal time zone list

Php date_default_timezone_set () sets the default time zone of the date/time function

Php date_default_timezone_get () gets the default time zone used by the DATETIME function

Php checkdate () function verification date is valid (correct)

Essential for watching the sunrise in Taishan

The if statement of the Alternative PHP-if statement is used to execute code only when the specified condition is set. Syntax if (condition) {code to be executed when the condition is set;} if the current time is less...

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.