In addition to the "if" statement, PHP provides a "IF-ELSE" structure to define the PHP code that executes when the condition in the statement is described as a value of "false."
The "IF-ELSE" structure uses the following methods:
--------------------------------------------------------------------------------
if (condition)
{
Do this!
}
Else
{
Do this!
}
--------------------------------------------------------------------------------
You will see that this structure can be used to simplify the previous example-instead of two separate "if" statement nesting, we can mix them in a single "If-else" statement:
Check the name and feedback the appropriate information
if ($name = = "Neo")
{
?>
< font face= "Arial" size= "-1" >
Welcome into the matrix, Neo.
< p>
Maybe it was force to force you to do it,,, Oh, improper film!
</FONT>
<?
}
Else
{
?>
< font face= "Arial" size= "-1" >
I wonder if you've ever heard of Shakespeare, <? Echo $name;
< p>
He asked for a rose of another name, because the bouquet might smell more aromatic.
< p>
For you, unfortunately, I disagree. Refused to enter!
</FONT>
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