Discuss one reason why PHP has both elseif and elseif

Source: Internet
Author: User
To discuss why PHP will have both elseif and elseif, which are described in the PHP Manual. I'm curious about why PHP will have both? Elseif is a combination of & nbsp; if & nbsp; and & nbsp; else & nbsp. Like & nbsp; else & nbsp;, it extends & nbsp; I to discuss why PHP has both elseif and else if
The following are some of the statements in the PHP Manual. I'm curious about why PHP has both of them?
Elseif is a combination of if and else, which is similar to the alias. Like else, it extends the if statement and can execute different statements when the original if expression value is FALSE. But unlike else, it only executes the statement when the conditional expression value of elseif is TRUE. For example, the following code displays a is bigger than B, a equal to B, or a is smaller than B based on the conditions:
If ($ a> $ B ){
Echo "a is bigger than B ";
} Elseif ($ a ==$ B ){
Echo "a is equal to B ";
} Else {
Echo "a is smaller than B ";
}
?>

Multiple elseif statements can exist in the same if structure. The elseif statement with the first expression value TRUE (if any) will be executed. In PHP, you can also write "else if" (two words), which is identical to "elseif" (one word. The meaning of syntactic analysis is slightly different (if you are familiar with the C language, this is the same behavior), but the bottom line is that the two will produce the same behavior.

The elseif statement is executed only when the previous if or elseif expression value is FALSE and the current elseif expression value is TRUE.

Note: note that elseif and else if are considered to be identical only when braces are used in similar cases. Note that elseif and else if will only be considered exactly the same when using curly brackets as in the above example. when using a colon to define your if/elseif conditions, you must not separate else if into two words, or PHP will fail with a parse error.
 
------ Solution --------------------
I don't think it's very interesting to discuss this question!

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.