This is because of type conversion, see also manual chapter 'Type juggling'.

"foo" converted to integer type is also zero, if you try "1foo" for 
example, it will convert to one.

if you want to check without type conversion use the === operator instead.

bvr.


Jan Rademaker wrote:

>Can someone explain why this works?
>
>$x = 0;
>if ($x == "foo") {
>       print "yeah";
>}
>
>This prints 'yeah', but i can't figure out why...
>




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

Reply via email to