Why PHP 4.4.9 throws 'Parse error: syntax error, unexpected T_STATIC'? [closed]

孤街浪徒 提交于 2019-12-05 11:41:02

I'm pretty sure static class variables are new to PHP5, so can't be used in PHP4.

Here's the deal: PHP4 can use the static keyword in functions, not classes. The only PHP4 usage of static was like this:

function howManyTimes() {
    static $count = 0;
    echo "Function has been called $count times.";
    $count++;
}

That variable is bound to the function's scope forever. That's how PHP4 interprets static. The PHP5 interpretation you are trying to use is not available in your current PHP version. Sorry!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!