note 92484 deleted from control-structures.if by danbrown
| From: | danbrown@php.net | Date: | Mon, 27 Jul 2009 03:20:18 +0000 |
| Subject: | note 92484 deleted from control-structures.if by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-158757@lists.php.net to get a copy of this message | ||
Note Submitter: d at lbjerg dot com
----
If you want to compare 2 variables, where the first is a integer and the second could both integer
or a string, you should be very careful.
Example:
if($var_1 == $var_2)
{
echo "They match";
}
else
{
echo "They do not match":
}
if $var_1 and $var_2 is both the same number, it will of course write "They match", and if
they are not then it will write "They do not match"
However if $var_1 is 0 and $var_2 is forexample "unlimited", then it will write "They
match".