note 95908 added to language.types.boolean
| From: | codiemorganatgmail dot com at osu1 dot php dot net | Date: | Thu, 28 Jan 2010 10:33:41 +0000 |
| Subject: | note 95908 added to language.types.boolean | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-165401@lists.php.net to get a copy of this message | ||
Correction for "russell dot harper at springboardnetworks dot com".
0.0 does return false, because 0.0 = 0.
the reason you are getting a TRUE from your value is because your are putting 0.0 inside a string.
yours: print '0.0'."\t".((bool)'0.0'? 1: 0)."\n";
try: print 0.0."\t".((bool)0.0? 1: 0)."\n";
"0.0" => true; Because it is a non empty string.
'0.0' => true; Because it is a non empty string.
0.0 => false; because it is a value equal to 0.
for "" = false while "0.0" and "200" = true;
----
Server IP: 69.147.83.197
Probable Submitter: 196.210.177.197
----
Manual Page -- http://www.php.net/manual/en/language.types.boolean.php
Edit -- https://master.php.net/note/edit/95908
Del: integrated -- https://master.php.net/note/delete/95908/integrated
Del: useless -- https://master.php.net/note/delete/95908/useless
Del: bad code -- https://master.php.net/note/delete/95908/bad+code
Del: spam -- https://master.php.net/note/delete/95908/spam
Del: non-english -- https://master.php.net/note/delete/95908/non-english
Del: in docs -- https://master.php.net/note/delete/95908/in+docs
Del: other reasons-- https://master.php.net/note/delete/95908
Reject -- https://master.php.net/note/reject/95908
Search -- https://master.php.net/manage/user-notes.php