Because you are telling the parser to compare a numeric variable against something called "foo" which (in your context) has to be numerical too. Since "foo" has not been given any value, the parser defaults it to 0. So foo = 0. So is true that foo=$x=0.
Alex. ----- Original Message ----- From: "Jan Rademaker" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, March 19, 2002 11:30 AM 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