PHP4 Practical Application Experience (4)

Source: Internet
Author: User
Keywords PHP4 Practical Application Experience (4)
Author: Sun Sports

In addition to the "if" statement, PHP provides a "IF-ELSE" structure that defines the PHP code that executes when the condition in the statement is described as a value of "false".


The "IF-ELSE" structure is used in the following ways:

--------------------------------------------------------------------------------
if (condition)
{
Do this!
}
Else
{
Do this!
}
--------------------------------------------------------------------------------
You will see that this structure can be used to greatly simplify the previous example-instead of nesting two separate "if" statements, we can mix them in a single "If-else" statement:

--------------------------------------------------------------------------------

< html>
< head>
< Basefont face= "Arial" >

< body>
< center>

<?

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 the force that forced 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 demanded a bouquet of roses for another name, because that bundle might smell more fragrant.
< p>
For you, unfortunately, I disagree. Refuse to enter!
</FONT>

<?
}
?>


</center>
</body>

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