RE: [PHP] Please explain...

From: Date: Tue, 19 Mar 2002 10:19:04 +0000
Subject: RE: [PHP] Please explain...
Groups: php.general 
Request: Send a blank email to php-general+get-89093@lists.php.net to get a copy of this message
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:rudolf@dhsolutions.co.za> Tel: 011 2655478 Cell: 082 895 1598 -----Original Message----- From: Jan Rademaker [mailto:janr@486.yi.org] Sent: Tuesday, March 19, 2002 12:31 PM To: php-general@lists.php.net 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 (#89093) next »