if you have a COMPOUND conditional statement ( such as "IF") that based on the return value of a function... FOR EXAMPLE:
if ( foo()>0 && foo()%2==1 && (foo()==7 || foo()!=2){...} // the value returned by foo() is not used anywhere else is the function called multiple times or is the value cached by PHP?

I guess what I am asking is ... tho it would involve an ADDITIONAL LINE of code and memory allocation , in situations as described is better to store the value returned foo() in a variable or are there NO significant gains ( other than organizational) ?