note 104643 added to function.is-bool
| From: | Spektrum at osu1 dot php dot net | Date: | Mon, 27 Jun 2011 20:21:47 +0000 |
| Subject: | note 104643 added to function.is-bool | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-181008@lists.php.net to get a copy of this message | ||
If you want to convert a string representation of a boolean ,like "yes", "on",
"true", "false",etc..., to an actual boolean, you can try this:
<?php
$myString = "On";
$b = filter_var($myString, FILTER_VALIDATE_BOOLEAN);
?>
This will return TRUE for "1", "true", "on" and "yes".
Returns FALSE otherwise.
----
Server IP: 69.147.83.197
Probable Submitter: 67.214.225.82
----
Manual Page -- http://www.php.net/manual/en/function.is-bool.php
Edit -- https://master.php.net/note/edit/104643
Del: integrated -- https://master.php.net/note/delete/104643/integrated
Del: useless -- https://master.php.net/note/delete/104643/useless
Del: bad code -- https://master.php.net/note/delete/104643/bad+code
Del: spam -- https://master.php.net/note/delete/104643/spam
Del: non-english -- https://master.php.net/note/delete/104643/non-english
Del: in docs -- https://master.php.net/note/delete/104643/in+docs
Del: other reasons-- https://master.php.net/note/delete/104643
Reject -- https://master.php.net/note/reject/104643
Search -- https://master.php.net/manage/user-notes.php