Re: Re: PHP 4.0 Bug #4805 Updated: !1 could return 0 instead of false

From: Date: Mon, 05 Jun 2000 00:49:08 +0000
Subject: Re: Re: PHP 4.0 Bug #4805 Updated: !1 could return 0 instead of false
References: 1 2 3 4  Groups: php.dev 
Request: Send a blank email to php-dev+get-20220@lists.php.net to get a copy of this message
Michal Vitecek writes: > maybe the whole lot of problems wouldn't have happened if the boolean > value wasn't introduced to php at all. having boolean in php makes php as > a language less consistent in my opinion: 'echo true' prints 1, whereas > 'echo false' doesn't print anything, 2 != true is 1/true in php3 but > 0/false in php4 etc. I'm not sure why PHP has a boolean type either when it casts types all over the place. Boolean types are for functions and vars that expect to have a boolean type, and they're not really supposed to undergo implicit coercion. Their entire reason for being is to prevent other types from getting treated as logical values when it wasn't intended for that type to be passed in in the first place. That said, I notice PHP 4 has a "declare" statement, so possibly they are planning on adding optional strong typing in the future (and if this wasn't the intent, it would be REALLY REALLY NICE to have :) chuck "I am not a number, I am instanceof FreeMan!" adams

« previous php.dev (#20220) next »