Re: Please explain...

From: Date: Tue, 19 Mar 2002 10:42:18 +0000
Subject: Re: Please explain...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-89094@lists.php.net to get a copy of this message
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" <janr@486.yi.org> To: <php-general@lists.php.net> 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 <janr@486.yi.org> > http://www.ottobak.com > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#89094) next »