【发布时间】:2010-10-07 01:59:21
【问题描述】:
我在 codepad.org 中尝试了以下代码:
class test {
const TEST = 'testing 123';
function test () {
$testing = 'TEST';
echo self::$testing;
}
}
$class = new test;
它返回:
1
2 Fatal error: Access to undeclared static property: test::$testing on line 6
我想知道使用变量引用类常量是否可以在我家运行 php 5.2.9 而 codepad 使用 5.2.5 的服务器上工作。 各个版本的 PHP 对类变量有何变化?
【问题讨论】:
标签: php class-variables