Author: Sun sports
In addition to the "if" Statement, PHP also provides the "if-Else" structure to define the PHP code executed when the condition description in the statement is "false ".Code.
The "If-Else" structure is used as follows:
--------------------------------------------------------------------------------
If (condition)
{
Do this!
}
Else
{
Do this!
}
--------------------------------------------------------------------------------
You will see that this structure can be used to greatly simplify the previous example-replace two separate "if" Statement nesting, we can mix them in a single "If-Else" statement:
--------------------------------------------------------------------------------
<HTML>
<Head>
<Basefont face = "Arial">
</Head>
<Body>
<Center>
<?
// Check the name and feedback the corresponding information
If ($ name = "Neo ")
{
?>
<Font face = "Arial" size = "-1">
Welcome to the parent, Neo.
<P>
You may have been forced to do this by force, oh, an improper film!
</Font>
<?
}
Else
{
?>
<Font face = "Arial" size = "-1">
I want to know if you have heard of Shakespeare, <? Echo $ name;?>.
<P>
He asked to get a bunch of roses from another name, because it may smell more fragrant.
<P>
Unfortunately, I don't agree with you. Access denied!
</Font>
<?
}
?>
</Center>
</Body>
</Html>