On 09/03/2017 05:48 PM, David Rodrigues wrote:
 From doc: http://php.net/manual/en/language.variables.scope.php

Note: Static variables may be declared as seen in the examples above.
 From PHP 5.6 you can assign values to these variables which are the result
of expressions, but you can't use any function here, what will cause a
parse error.
Ahh, thanks a lot, I missed that one... I guess this change is to optimize the performance of PHP somehow. Now I will have to make a search on my code base to see where I'm using more functions that use static variables to store the return value of a function (to speed stuff up) and change it on a way that is compatible...

static $var = array();

if(empty($var))
{
    $var = function_output();
}

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to