I tried the following code in codepad.org:
class test {
const TEST = 'testing 123';
function test () {
$testing = 'TEST';
echo self::$testing;
}
}
$class = new test;
And it returned with:
1
2 Fatal error: Access to undeclared static property: test::$testing on line 6
I want to know whether referencing a class constant with a variable would work on my server at home which runs php 5.2.9 whereas codepad uses 5.2.5 . What are changes in class variables with each version of PHP?