Date: 05/17/01
- Next message: marija <email protected>: "[PHP-DEV] Bug #10929: got "segmentation fault" after successful compile"
- Previous message: Sebastian Bergmann: "[PHP-DEV] Boolean weirdness?"
- In reply to: Sebastian Bergmann: "[PHP-DEV] Boolean weirdness?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, 17 May 2001, Sebastian Bergmann wrote:
> 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
> :)
Anything that's not 0 is true.
-Andrei
"Try to spend the next 30 seconds not thinking
about a blue-eyed polar bear." -Feodor Dostoevsky
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: marija <email protected>: "[PHP-DEV] Bug #10929: got "segmentation fault" after successful compile"
- Previous message: Sebastian Bergmann: "[PHP-DEV] Boolean weirdness?"
- In reply to: Sebastian Bergmann: "[PHP-DEV] Boolean weirdness?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

