note 58675 deleted from function.empty by didou
| From: | didou@php.net | Date: | Sun, 18 May 2008 00:58:08 +0000 |
| Subject: | note 58675 deleted from function.empty by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-139484@lists.php.net to get a copy of this message | ||
Note Submitter: inerte is my gmail.com username
----
empty() is about 10% faster than a comparision.
if (empty($var)) {
}
is faster than:
if ($var == '') {
}
YMMV, empty() also checks array and attributes, plus 0, and '' is kind a string with
nothing inside. But I was using '' and got a huge performance boost with empty().
PHP 4.3.10-15, Apache/2.0.54, Kernel 2.4.27-2-386.