Re: Allow non-variable arguments to empty()
| From: | Kris Craig | Date: | Wed, 11 Apr 2012 00:08:42 +0000 |
| Subject: | Re: Allow non-variable arguments to empty() | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-59690@lists.php.net to get a copy of this message | ||
On Tue, Apr 10, 2012 at 4:51 PM, Stas Malyshev <smalyshev@sugarcrm.com>wrote:
> Hi!
>
> > Currently the empty() language construct only works on variables. You
> > can write if (empty($array)) but not empty if (empty(getSomeArray()).
> >
> > The original reason for this restriction probably is that - in a way -
> > it "doesn't make sense" to pass anything but a variable to empty() as
> > you could just use the ! operator in this case. if
> > (empty(getSomeArray())) is logically equivalent to if
> > (!getSomeArray()).
>
> Don't see any problem with that, looks good. Please add some tests
> (including function calls and some expressions) and make a pull request.
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Err isn't this something that should go through the RFC process first? I
think it's a good idea and I'll probably vote for it, but as I understand
the RFC process was created specifically for stuff like this.
--Kris