Re: Allow non-variable arguments to empty()

From: Date: Tue, 10 Apr 2012 23:51:06 +0000
Subject: Re: Allow non-variable arguments to empty()
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-59687@lists.php.net to get a copy of this message
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

« previous php.internals (#59687) next »