PHP4 Practical Application Experience 9_php Tutorial

Source: Internet
Author: User
Author: Sun Sports
"= = =" operator
------------------------
As we mentioned above, PHP4 adds a new = = = operator to test if the variable has the same type. Here's an example:
--------------------------------------------------------------------------------
<?
if (! $submit)
{
If $submit does not exist, this implies that the form has not yet been submitted
So the first page is displayed
?>
< html>
< head>
< style type= "Text/css" >
td {Font-family:arial;}
</style>
< body>
< form method= "GET" action= "cookie.php" >
< table cellspacing= "5" cellpadding= "5" border= "0>
< tr>
< TD align= "Center" >
Please enter any value or data
</td>
< TD align= "right" >
< input type= "text" name= "Yin" >
</td>
</tr>
< tr>
< TD align= "Center" >
Please enter some more values or data
</td>
< TD align= "right" >
< input type= "text" name= "Yang" >

</td>
</tr>
< tr>
< tr>
< TD colspan= "2" align= "Center" >
< input type= "submit" name= "Submit" value= "test!" >
</td>
</tr>
</table>
</form>
</body>
<?
}
Else
{
If the $submit does exist, the form has already been submitted.
So use the following code to handle
if ($yin = = = $yang)
{
$result = "Two variables are identical in value and type";
}
Else
{
$result = "Two variable values and types are completely different";
}
?>
< html>
< head>
< Basefont face= "Arial" >
< body>
< b><? echo $result;?></b>
</body>
<?
}
?>
--------------------------------------------------------------------------------
Select syntax
------------------
PHP also supports a choice syntax for the various control structures currently discussed. For example, you can do this:
--------------------------------------------------------------------------------
<?
if ($elvis = = 0)
{
echo "Elvis has left the building!";
}
Else
{
echo "Elvis is still here!";
}
?>
Or you can do this:
<?
if ($elvis = = 0):
echo "Elvis has left the building!";
Else
echo "Elvis is still here!";
endif
?>
--------------------------------------------------------------------------------
The second option is exactly the same as the first one, where you simply replace the first parenthesis with a colon [:], remove the second large bracket, and end with the "endif" statement.
These are the contents of the second part. Next time, we will bring you loops, arrays and more forms-so be sure not to miss it!

http://www.bkjia.com/PHPjc/509180.html www.bkjia.com true http://www.bkjia.com/PHPjc/509180.html techarticle Author: Sun movement "= = =" Operator------------------------as we have mentioned above, PHP4 adds a new = = = operator to test whether the variable has the same type. This ...

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