note 112174 added to function.boolval
| From: | Linuxatico | Date: | Tue, 14 May 2013 08:42:00 +0000 |
| Subject: | note 112174 added to function.boolval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-194796@lists.php.net to get a copy of this message | ||
Well, considering that is common to code in OO, this snippet is not right, this solved for me:
class A {
public function boolVal($val)
{
if (!function_exists('boolval')) {
return (bool) $val;
}
else { return boolval($val); }
}
}
and in my project I do:
$a = new A();
$a->boolVal($val);
----
Server IP: 69.147.83.199
Probable Submitter: 93.62.62.50
----
Manual Page -- http://php.net/manual/en/function.boolval.php
Edit -- https://master.php.net/note/edit/112174
Del: integrated -- https://master.php.net/note/delete/112174/integrated
Del: useless -- https://master.php.net/note/delete/112174/useless
Del: bad code -- https://master.php.net/note/delete/112174/bad+code
Del: spam -- https://master.php.net/note/delete/112174/spam
Del: non-english -- https://master.php.net/note/delete/112174/non-english
Del: in docs -- https://master.php.net/note/delete/112174/in+docs
Del: other reasons-- https://master.php.net/note/delete/112174
Reject -- https://master.php.net/note/reject/112174
Search -- https://master.php.net/manage/user-notes.php