note 108469 deleted from function.is-bool by cmb
| From: | cmb@php.net | Date: | Fri, 01 Feb 2019 14:39:43 +0000 |
| Subject: | note 108469 deleted from function.is-bool by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-210170@lists.php.net to get a copy of this message | ||
Note Submitter: vincent at lycoops dot be
----
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.
}
?>