$a === $b

TRUE if $a is equal to $b, and they are of the same type. (PHP 4 only) 

> -----Original Message-----
> From: David Freeman [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 29, 2003 7:39 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP] if (a == b) ...
> 
> 
> 
>  > I have a conditional:
>  > if (a == b)
>  >
>  > a is the number 0, but b is a string "Friday August 22".
>  >
>  > The condition is evaluating as true, which is not what I want.
>  > What am I misunderstanding?
> 
> You're comparing a string to a number perhaps?
> 
> I tried this:
> 
> -----8<-----
> $a = 0;
> $b = "Friday August 22";
> 
> if ($a == $b)
> {
>   echo "match";
> } else {
>   echo "no match";
> }
> -----8<-----
> 
> and resulted in 'match', then I tried this:
> 
> -----8<-----
> $a = "0";
> $b = "Friday August 22";
> 
> if ($a == $b)
> {
>   echo "match";
> } else {
>   echo "no match";
> }
> -----8<-----
> 
> and resulted in 'no match'.
> 
> It's worth remembering that the number 0 has somewhat special meaning in
> php as a true/false indication.
> 
> CYA, Dave
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to