Reputation: 165
If i try do something like this:
$title = $this->fullSearchForm->get('title')->getValue();
if(!empty($title)) {
echo "ok";
}
evrything is ok.
But i below case
if(!empty($this->fullSearchForm->get('title')->getValue())) {
echo "OK";
}
I get error
Can't use method return value in write context in
My php is from debian stable Whezzy PHP 5.4.4-14+deb7u8 (cli) (built: Feb 17 2014 09:18:47) Thanks for answer
Upvotes: 1
Views: 82
Reputation: 324620
In your context, you should be using:
if( $this->fullSearchForm->get('title')->getValue()) {
echo 'OK';
}
Because empty
checks if a variable is set and not falsy, but a function's return value is always "set" so basically it's just a check for falsiness.
empty
operates on variables, NOT functions.
Upvotes: 2