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>
The above describes the practical application of PHP4 4, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.