Using boolean function return or setting the return to a variable?
<p>I was wondering whether it is more efficient to set a function's <code>return</code> to a variable, since  if you were to use it in arguments, wouldn't they have to go through the function again?</p>

<p>For instance:</p>

<pre><code>function check() {
    foreach() {
        // insert long foreach loop here
        return true;
    }
}

if(check() == 1 || check() === true) {
    // had to go through the function twice?
}

$check = check();
if($check == 1 || $check === true) {
    // only has to go through the function once
}
</code></pre>

<p>I was wondering whether PHP somehow saved the results from the first run through the function or whether it goes through the function each time (which seems inefficient if the arguments are the same - in this case, none).</p>

<p>If anyone wants to suggest a better title or edit it, go ahead.</p>
