note 108469 added to function.is-bool
| From: | vincent at lycoops dot be | Date: | Sat, 28 Apr 2012 12:22:35 +0000 |
| Subject: | note 108469 added to function.is-bool | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-187392@lists.php.net to get a copy of this message | ||
For those of you who think that micro-optimization is important:
It's quicker to strictly compare a value to TRUE and FALSE, than using is_bool(), because
it's a function.
<?php
if (is_bool($var)) { // 100% of time
}
if ($var === true || $var === false) { // 50% of time, if $var is true and 75% of time if $var is
false.
}
?>
----
Server IP: 79.99.203.17
Probable Submitter: 87.65.149.142
----
Manual Page -- http://www.php.net/manual/en/function.is-bool.php
Edit -- https://master.php.net/note/edit/108469
Del: integrated -- https://master.php.net/note/delete/108469/integrated
Del: useless -- https://master.php.net/note/delete/108469/useless
Del: bad code -- https://master.php.net/note/delete/108469/bad+code
Del: spam -- https://master.php.net/note/delete/108469/spam
Del: non-english -- https://master.php.net/note/delete/108469/non-english
Del: in docs -- https://master.php.net/note/delete/108469/in+docs
Del: other reasons-- https://master.php.net/note/delete/108469
Reject -- https://master.php.net/note/reject/108469
Search -- https://master.php.net/manage/user-notes.php