Discover php if else statement example, include the articles, news, trends, analysis and practical advice about php if else statement example on alibabacloud.com
Before you introduce the "if" statement, know that the "if" statement is to meet the expression when the execution of a PHP statement, when the condition is not satisfied, is not executed, but, in most cases, always meet the conditions when the
1, if statement
An If statement is an important feature in most languages, and it executes the program segment according to the conditions. PHP's If statement is similar to C:
if (expr)
Statement
As discussed in an expression, expr is computed
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
First, If...else statement
If...else statement
Executes a piece of code when the condition is set, and executes another piece of code when the condition is not established
Grammar:
1. Simple condition
if (condition) {......}else{......}
Cases
conditional Statements
When you write code, you often need to perform different actions for different judgments.
You can use conditional statements in your code to accomplish this task.
If...else statements
Executes a piece of code when the
First, If...else statement
If...else statement
Executes a piece of code when the condition is set, and executes another piece of code when the condition is not established
Grammar:
1. Simple condition
if (condition) {
......
}
else{
......
In all programming languages, such as C language. JAVA and so on, all have the existence of if statements, of course, also include PHP. The if statement is used to select and execute different code snippets according to the conditions.
If statement
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
Condition Statement
When writing code, you often need to perform different actions for different judgments.
You can use conditional statements in the code to complete this task.
If... else statement
Execute one piece of code when the conditions are
Conditional statement
When you write code, you often need to perform different actions for different judgments.
You can use conditional statements in your code to accomplish this task.
If...else statement
Executes a piece of code when the
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.