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

Change the color of an oval at click in Java AWT -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -