This code throws parse error, which I do not understand why.
function t(){
return 'g';
}
function l(){
static $b = t();
return $b;
}
l();
The question is, why?
Quoting from the manual:
Note:
Trying to assign values to these [static] variables which are the result of expressions will cause a parse error.
(my emphasis)
c.f. http://www.php.net/manual/en/language.variables.scope.php Example #7
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With