note 73926 deleted from function.empty by danbrown
| From: | danbrown@php.net | Date: | Fri, 28 Nov 2008 22:08:01 +0000 |
| Subject: | note 73926 deleted from function.empty by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-147304@lists.php.net to get a copy of this message | ||
Note Submitter:
----
Speed comparisons between empty($foo) versus !$foo are pointless; you're saving what, a couple
dozen nanoseconds? If you care that much you'll have to benchmark every single new version of
PHP in case changes affect the relative speeds of your various methods, and then recode if one
method overtakes another. Now THAT is a waste of time.
Far more important is that your code says what you want it to mean.
Besides, when $foo is not set empty($foo) is >1400% faster than !$foo (and that's AFTER
suppressing the notice message).