Re: Allow non-variable arguments to empty()
| From: | Johannes Schlüter | Date: | Tue, 10 Apr 2012 23:31:40 +0000 |
| Subject: | Re: Allow non-variable arguments to empty() | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-59685@lists.php.net to get a copy of this message | ||
On Tue, 2012-04-10 at 19:12 -0400, Jelle Zijlstra wrote:
> I think this is a useful simplification of the language, removing an
> unnecessary exception. Would it also make sense to make empty() into a
> library function instead of a language construct? That would not
> result in
> any BC break as far as I can see, but would allow some things that are
> currently impossible (e.g., a method called "empty") and further
> simplify
> the language.
It would, as an empty function would spit notices if the variable
doesn't exist (or would have to use references, which would create the
variable if it didn't exist already) and therefore destroy the primary
use of that construct ... oh and such an empty won't be different from a
simple "if" or bool cast.
johannes