如何使用php isset一个函数?

The following IF statement causes ZendFramework to error (with a blank screen). PhpStorm indicates expected variable with a red indicator after ('page_reference'). Is there a way I may execute this IF statement without causing an error?

if ( isset( $this->params()->fromRoute('page_reference') ) ) {

} else {

}

As you can see in php documentation isset is meant to be used in a variable context.

Warning isset() only works with variables as passing anything else will result in a parse error. For checking if constants are set use the defined() function.

In this case it's possible to solve this in a simple way:

if ( $this->params()->fromRoute('page_reference') !== null ) {

} else {

}

Notice, the second parameter of fromRoute is $default = null, and can be used to pass the expected value when the 'page_reference' is not defined.