0
我試過下面的代碼在codepad.org:類變量,範圍解析運營商和不同版本的PHP
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而鍵盤使用5.2.5。 每個PHP版本的類變量有什麼變化?