note 123510 added to function.is-bool
| From: | phil@php.net | Date: | Thu, 10 Jan 2019 18:21:47 +0000 |
| Subject: | note 123510 added to function.is-bool | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-210033@lists.php.net to get a copy of this message | ||
It should be stated that this function returns true if the _type_ of it's argument is boolean.
It does not convert or coerce the value to a boolean type, not sure why so many comments focus on
how to do this.
However, if you arrived here looking for a solution to convert a value to a boolean type, use this:
to_bool($x) { return (bool)$x; }
----
Server IP: 208.43.231.9
Probable Submitter: 82.199.157.35 (proxied: 107.1.251.186)
----
Manual Page -- http://php.net/manual/en/function.is-bool.php
Edit -- https://master.php.net/note/edit/123510
Del: integrated -- https://master.php.net/note/delete/123510/integrated
Del: useless -- https://master.php.net/note/delete/123510/useless
Del: bad code -- https://master.php.net/note/delete/123510/bad+code
Del: spam -- https://master.php.net/note/delete/123510/spam
Del: non-english -- https://master.php.net/note/delete/123510/non-english
Del: in docs -- https://master.php.net/note/delete/123510/in+docs
Del: other reasons-- https://master.php.net/note/delete/123510
Reject -- https://master.php.net/note/reject/123510
Search -- https://master.php.net/manage/user-notes.php