Boolean weirdness?

From: Date: Thu, 17 May 2001 16:02:46 +0000
Subject: Boolean weirdness?
Groups: php.dev 
Request: Send a blank email to php-dev+get-55631@lists.php.net to get a copy of this message
Hey there, I was just bitten by a - IMHO - weirdness with boolean values: <?php $foo = -1; if ($foo) { print "bar"; } ?> The code above print 'bar'. I would expect if($x) t return true if $x is an integer and greater that zero. This is what my intuition tells me :) Just a thought, Sebastian -- sebastian bergmann sb@sebastian-bergmann.de http://www.sebastian-bergmann.de bonn.phpug.de | www.php.net | www.phpOpenTracker.de | www.titanchat.de

« previous php.dev (#55631) next »