Skip to main content
2 of 4
added 87 characters in body
Geert
  • 6.3k
  • 29
  • 42
function my_big_function()
{
    static $result;

    // Function has already run
    if ($result !== NULL)
        return $result;

    // Lot of work to determine $result

    $result = TRUE;
    return $result;
}

Also see: http://stackoverflow.com/questions/6188994/static-keyword-inside-function

Geert
  • 6.3k
  • 29
  • 42