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;
If
(PHP 4, PHP 5)
The IF structure is one of the most important features in many languages, including PHP, which allows code snippets to be executed on a conditional basis. The IF structure of PHP is similar to the C language:
As defined in the
Discuss why PHP has both ElseIf and else if
these words are in the PHP manual, I am more curious about why PHP will exist at the same time these two ways?
ElseIf, as implied by this name, is the combination of if and else. As with else, it extends
Any php Tutorial script consists of a series of statements. A statement can be a value assignment statement, a function call, a loop, or even a (null statement) condition statement that does nothing. The statement usually ends with a semicolon. In
This article mainly introduces the PHP process Control elseif/else If, has a certain reference value, now share to everyone, the need for friends can refer to
This paper tries to use the basic Learning Master, please close this page
Read this
1. If
The IF structure is one of the most important features in many languages, including PHP, which allows code snippets to be executed on a conditional basis. The IF structure of PHP is similar to the C language:
if (expr)Statement
As defined in
I haven't noticed before. I know that when I enter the company, I read more code and often see the elseif Branch. I often use elseif, so I noticed that, since they can all use it, where are they not? Through the query, it turns out that there is a
PHP ElseIf and else if difference
If, ElseIf, and ELSE statements are used to perform different actions based on different conditions.
Conditional statementWhen you write code, you often need to perform different actions for different
If ... Else statement
Use the If....else statement if you want to execute some code when a condition is set up and execute some other code when the condition is not valid.
Grammar
The code is as follows
Copy Code
if
PHP smarty Template conditional selection structure If-elseif-else,{if} must be paired with {/if}, but you can also use {else} and {ElseIf} clauses, and the following modifiers can be used in {if}:
If instance
{if} instance:
{if $name eq ' Fred '}
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.