note 99361 deleted from language.types.boolean by danbrown
| From: | danbrown@php.net | Date: | Thu, 12 Aug 2010 17:16:47 +0000 |
| Subject: | note 99361 deleted from language.types.boolean by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-171620@lists.php.net to get a copy of this message | ||
Note Submitter: passeyhead at gmail dot com
----
In response to fyrye at torntech dot com's function, I took it one step further to this:
<?php
private function setBool($val)
{
return ((int)$val == 1 || $val === TRUE) ? TRUE : FALSE;
}
?>
My reasoning for the change was because the number 1 was being returned as false when in fact it
should be true. So, the only true values are true, '1', and 1. Everything else is false.