Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM), expecting ',' or ';' in E:\OpenServer\domains\mvc.local\test.php on line 18
<?php
class Foo
{
const CONSTANT = 'SomeValue';
}
class Bar
{
public $tmp;
function __construct()
{
$this->tmp = new Foo;
}
}
$object = new Bar;
echo $object->tmp::CONSTANT;
echo Foo::CONSTANT;
var_dump(constant(get_class($a) . '::CONSTANT'));