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
コードパッドが 5.2.5 を使用しているのに対し、変数を使用してクラス定数を参照することが自宅のサーバーで php 5.2.9 を実行している場合に機能するかどうかを知りたいです。PHP の各バージョンでのクラス変数の変更点は何ですか?