PHP Process Control, PHP process _php Tutorial

Source: Internet
Author: User
Tags sunrise time

PHP Process Control, PHP process


Php-if statements

The IF statement is used to execute code only when the specified condition is true .

Grammar

if (condition) {The code to execute when the condition is established;}

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

Instance

 
  

Run

Php-if...else statements

Execute a piece of code when the condition is established, and execute another piece of code when the condition is not established , using the If....else statement.

Grammar

if (condition) {code executed when the condition is established;} Code executed when the else{condition is not established;}

If the current time is less than 20, the following instance outputs "a good day!", otherwise the output "has a good night!" :

 
  

Php-if...else if....else Statements

To execute a block of code when one of several conditions is established , use the If....else if...else statement:

Grammar

if (condition) {The code executed when the condition is established;} else if (condition) {ElseIf code executed when the condition is established;} Code executed when the else{condition is not established;}

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

 
  

  

Original address: http://www.manongjc.com/php/php_if_switch.html

Related reading:

PHP date_sunrise () Get Sunrise time based on location (longitude latitude)

PHP Global legal time zone list Daquan

PHP Date_default_timezone_set () sets the default time zone for date/time functions

PHP date_default_timezone_get () Gets the default time zone used by the DateTime function

PHP checkdate () function verifies that the date is valid (correct)

Climbing Mount Tai To see the sunrise must-Taishan Sunrise time list

http://www.bkjia.com/PHPjc/1131138.html www.bkjia.com true http://www.bkjia.com/PHPjc/1131138.html techarticle PHP Process Control, PHP flow php-if statement If statement is used to execute code only when the specified condition is true. Syntax if (condition) {The code to execute when the condition is set;} If the current time is less than ...

  • 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.