PHP4 Practical Application Experience article 9

Source: Internet
Author: User

Author: Sun sports
"=" Operator
------------------------
As mentioned above, a new = Operator is added to PHP4 to test whether the variable has the same type. Here is an example:
--------------------------------------------------------------------------------
<?
If (! $ Submit)
{
// If $ submit does not exist, it indicates that the form has not been submitted.
// Display the first page
?>
<Html>
<Head>
<Style type = "text/css">
Td {font-family: Arial ;}
</Style>
</Head>
<Body>
<Form method = "GET" action = "cookie. php">
<Table cellspacing = "5" cellpadding = "5" border = "0>
<Tr>
<Td align = "center">
Enter any numeric value or data
</Td>
<Td align = "right">
<Input type = "text" name = "yin">
</Td>
</Tr>
<Tr>
<Td align = "center">
Enter another value 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>
</Html>
<?
}
Else
{
// If $ submit does exist, the form has been submitted.
// Use the following code for processing
If ($ yin ===$ yang)
{
$ Result = "the values and types of the two variables are identical ";
}
Else
{
$ Result = "two variable values and types are completely different ";
}
?>
<Html>
<Head>
<Basefont face = "Arial">
</Head>
<Body>
<B> <? Echo $ result;?> </B>
</Body>
</Html>
<?
}
?>
--------------------------------------------------------------------------------
Select syntax
------------------
PHP also supports a selection 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 the following:
<?
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. In this structure, replace the first large arc with a colon [:], remove the Second Large arc, and end with an "endif" statement.
These are the content of the second part. Next time, we will bring you loops, arrays and more forms-so do not miss it!

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.