Home > Backend Development > PHP Tutorial > PHP4 Practical Application Experience Chapter 4

PHP4 Practical Application Experience Chapter 4

WBOY
Release: 2016-07-29 08:34:16
Original
1057 people have browsed it

Author: Sun Movement
In addition to the "if" statement, PHP also provides the "if-else" structure, which is used to define the PHP code that is executed when the condition in the statement is described as a "false" value.
 The "if-else" structure is used as follows:
----------------------------------------- ------------------------------------------
if (condition)
{
do this!
}
else
{
do this!
}
---------------------------------- -----------------------------------------------
You will see As you can see, this structure can be used to greatly simplify the example from the previous article - instead of two separate "if" statements nested, we can mix them into 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 mother body, Neo.
< p>
Maybe you were forced to do this by force,,,oh, illicit video!
< /font>
< ?
}
else
{
?>
< font face="Arial" size="-1">
I was wondering if you've heard of Shakespeare, < ? echo $name; ?>.
< p>
He asked for a bouquet of roses with another name because that bouquet might smell more fragrant.
< p>
Unfortunately for you, I disagree. Entry refused!
< /font>
< ?
}
?>
< /center>
< /body>
< /html>

The above has introduced the practical application experience of PHP4 Part 4, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template