php - Can't use method return value in write context in -


if try this:

  $title = $this->fullsearchform->get('title')->getvalue();             if(!empty($title)) {                 echo "ok";             } 

evrything ok.

but below case

 if(!empty($this->fullsearchform->get('title')->getvalue())) {         echo "ok";     } 

i error

can't use method return value in write context in 

my php debian stable whezzy php 5.4.4-14+deb7u8 (cli) (built: feb 17 2014 09:18:47) answer

in context, should using:

if( $this->fullsearchform->get('title')->getvalue()) {     echo 'ok'; } 

because empty checks if variable set , not falsy, function's return value "set" it's check falsiness.

empty operates on variables, not functions.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -