note 122487 deleted from function.empty by cmb
| From: | cmb@php.net | Date: | Sun, 01 Dec 2019 09:22:47 +0000 |
| Subject: | note 122487 deleted from function.empty by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213358@lists.php.net to get a copy of this message | ||
Note Submitter: bert at elicom dot nl
----
Never EVER use the empty() function.
There are good alternatives (e.g. explicitly checking against '', 0, and '0'),
and since PHP variable types are determined by context, it will be unclear what a particular empty()
is doing in your code. Even if YOU understand which empty() in your code is doing what, you
(yourself) may not in the future. Or someone else may one day be studying/using/building upon your
code, and this other person may not even know about the misleading behavior of empty(). So, even if
YOU know exactly where to use and not use empty(), and what exactly it will do for you, help your
fellow coders by never using it.