dqpfkzu360216 2016-11-23 10:34
浏览 96

使用static ::关键字的最低PHP版本是多少?

When using something like

class MyClass
{
    public static function myFunction()
    {
        static::myOtherFunction();
    }

    private static function myOtherFunction()
    {
        …
    }
}

the PHP parser will complain

Parse error: syntax error, unexpected T_STATIC in ….php on line …

in older PHP versions. I couldn't find a reference though, what the minimum PHP version would be to use the static keyword like that.

  • 写回答

2条回答 默认 最新

  • douwenan9849 2016-11-23 10:38
    关注

    It's 5.3.0

    As of PHP 5.3.0, it's possible to reference the class using a variable. The variable's value cannot be a keyword (e.g. self, parent and static).

    via http://php.net/manual/en/language.oop5.static.php

    评论

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥20 求用stm32f103c6t6在lcd1206上显示Door is open和password:
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法