Re: Allow non-variable arguments to empty()

From: Date: Tue, 10 Apr 2012 23:37:49 +0000
Subject: Re: Allow non-variable arguments to empty()
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-59686@lists.php.net to get a copy of this message
2012/4/10 Johannes Schlüter <johannes@schlueters.de> > 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 > > You are quite right; I'm sorry for forgetting about that.

« previous php.internals (#59686) next »