note 73926 added to function.empty
| From: | php-general at lists dot php dot net | Date: | Thu, 15 Mar 2007 22:02:16 +0000 |
| Subject: | note 73926 added to function.empty | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-124493@lists.php.net to get a copy of this message | ||
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).
----
Server IP: 203.89.181.184
Probable Submitter: 60.234.168.92
----
Manual Page -- http://www.php.net/manual/en/function.empty.php
Edit -- https://master.php.net/note/edit/73926
Del: integrated -- https://master.php.net/note/delete/73926/integrated
Del: useless -- https://master.php.net/note/delete/73926/useless
Del: bad code -- https://master.php.net/note/delete/73926/bad+code
Del: spam -- https://master.php.net/note/delete/73926/spam
Del: non-english -- https://master.php.net/note/delete/73926/non-english
Del: in docs -- https://master.php.net/note/delete/73926/in+docs
Del: other reasons-- https://master.php.net/note/delete/73926
Reject -- https://master.php.net/note/reject/73926
Search -- https://master.php.net/manage/user-notes.php