Hello!
I am reading online manual about Class.
And I have tested the following:
Excerpt from manual:
http://hk.php.net/manual/en/language.oop5.constants.php
<?php
class MyClass
{
const constant = 'constant value';
function showConstant() {
echo self::constant . "\n";
}
}
echo MyClass::constant . "\n";
$classname = "MyClass";
echo $classname::constant . "\n";
//line 14 error: arse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting ',' or ';' in C:\Konami\homeipWebMirror\konami-asia\kdea\class-test.php on line 14
$class = new MyClass();
$class->showConstant();
echo $class::constant."\n";
?>
My php is version: 5.25
Did I missing something?
Thanks for reading.