I would guess that the string "foo" evaluates to integer 0 in the comparison
because $x is an integer, so that $x = 0 = true 
Use === (in PHP 4) to do type checking as well.

Rudolf Visagie
Principal Software Developer
Digital Healthcare Solutions
<mailto:[EMAIL PROTECTED]>
Tel: 011 2655478
Cell: 082 895 1598


-----Original Message-----
From: Jan Rademaker [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 19, 2002 12:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Please explain...


Can someone explain why this works?

$x = 0;
if ($x == "foo") {
        print "yeah";
}

This prints 'yeah', but i can't figure out why...

-- 
Jan Rademaker <[EMAIL PROTECTED]>
http://www.ottobak.com



-- 
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