Bug #14240 Updated: IF behaving weird

From: Date: Mon, 26 Nov 2001 20:35:54 +0000
Subject: Bug #14240 Updated: IF behaving weird
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-71710@lists.php.net to get a copy of this message
ID: 14240 Updated by: derick Reported By: kvzp@novae.dhs.org Old Status: Open Status: Closed Bug Type: *General Issues Operating System: Linux RedHat 7.1 PHP Version: 4.0.6 New Comment: This prints "12" for me, which is what I would expect. A string evaluates to 0 upon conversion to an integer. You should use === to check for both type and value. Derick Previous Comments: ------------------------------------------------------------------------ [2001-11-26 15:32:57] kvzp@novae.dhs.org $foo = "foo"; if ( "foo" == 0 ) { echo "1"; } if ( $foo == 0 ) { echo "2"; } ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=14240&edit=1

« previous php.dev (#71710) next »