Author: Sun Movement
“===” operator
--------------------------
We have already mentioned it above , PHP4 adds a new === operator to test whether variables have the same type. Here's an example:
------------------------------------------------ -----------------------------------------------
if (!$ submit)
{
// If $submit does not exist, it implies that the form has not been submitted yet
// So the first page is displayed
?>
td {font-family: Arial;}
Please enter any value or data
Please enter some more values or data
}
else
{
// If $submit does exist, the form has been submitted
// So use the following code to process
if ($yin === $yang)
{
$result = "The two variable values and types are exactly the same";
}
else
{
$result = "The values and types of the two variables are completely different";
}
?>
}
?>
----------------------------------------------- ----------------------------------
Select syntax
--------- ----------
PHP also supports a selection syntax for the various control structures discussed so far. 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. In this structure, simply replace the first brace with a colon [:], remove the second brace, and use " endif" statement to end.
These are the contents of the second part. Next time, we'll bring you loops, arrays, and more forms - so don't miss it!
http://www.bkjia.com/PHPjc/509180.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/509180.htmlTechArticleAuthor: Sun Movement "===" Operator------------- ----------- As we mentioned above, PHP4 added a new === operator to test whether variables have the same type. This...