note 114155 added to language.types.boolean
| From: | den | Date: | Fri, 17 Jan 2014 09:18:30 +0000 |
| Subject: | note 114155 added to language.types.boolean | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198265@lists.php.net to get a copy of this message | ||
Casting bools to string is not working as maybe expected:
echo 'true as string gives [' . (string) true . "] not [true].\n";
echo 'false as string gives [' . (string) false . "] not [false].\n";
Output:
true as string gives [1] not [true].
false as string gives [] not [false].
This helps around that behavior:
true ? 'true' : 'false'
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/language.types.boolean.php
Edit -- https://master.php.net/note/edit/114155
Del: integrated -- https://master.php.net/note/delete/114155/integrated
Del: useless -- https://master.php.net/note/delete/114155/useless
Del: bad code -- https://master.php.net/note/delete/114155/bad+code
Del: spam -- https://master.php.net/note/delete/114155/spam
Del: non-english -- https://master.php.net/note/delete/114155/non-english
Del: in docs -- https://master.php.net/note/delete/114155/in+docs
Del: other reasons-- https://master.php.net/note/delete/114155
Reject -- https://master.php.net/note/reject/114155
Search -- https://master.php.net/manage/user-notes.php