Hi,

empty() is confusing, because it is not a function, but a language construct, like isset(). As such, you can only use it on variables, and not on expressions or function return values.

See the very small print Note at the bottom of:

http://www.php.net/empty

Note: Because this is a language construct and not a function, it cannot be called using variable functions

Note: empty() only checks variables as anything else will result in a parse error. In otherwords, the following will not work: empty(addslashes($name)).

Regards,
Greg
--
phpDocumentor
http://www.phpdoc.org

Edward Rudd wrote:
I am having this rather annoying syntax problem.

I have this..
if (!empty($this->GetParam('someparameter')) {
  // OK do something since the parameter is set.
}
However that fails with this parse error

parse error, expecting `')''

Why???

If I do this
$var = $this->GetParam('someparameter'));
if (!empty($var)) {
  // same thing as before
}
it works fine with no error..

This *SHOULD* be syntactically correct, but php doesn't think so.
Should I file a bug on this one?
Oh yeah, normal information about running environment.
PHP version 4.3.2




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to