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.


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 (
To unsubscribe, visit:

Reply via email to