note 32321 added to language.types.boolean
| From: | adama at NO-UBE dot augustinefam dot org | Date: | Fri, 23 May 2003 15:13:14 +0000 |
| Subject: | note 32321 added to language.types.boolean | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-48897@lists.php.net to get a copy of this message | ||
Just a correction to the 29-Apr-2003 10:49 posting. The first section of the comment, where
$myBool = true ; print( $myBool ) ;
is indistinguishable from
print( "" ) ;
likewise,
$myBool = false ; print( $myBool ) ;
is indistinguishable from
print( 1 ) ;
is backwards. It should actually be
$myBool = true ; print( $myBool ) ;
is indistinguishable from
print( 1 ) ; //corrected
likewise,
$myBool = false ; print( $myBool ) ;
is indistinguishable from
print( "" ) ; //corrected
The posting makes a good point, though. Don't expect the contents of a string to mean something
special. As the documentation states, any non-empty string is true, including "false"
since it is simply a non-empty string.
----
Manual Page -- http://www.php.net/manual/en/language.types.boolean.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32321
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32321&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32321&report=yes