This is an very simplified example of some code that is probably overcoded, but I want to access a class member variable using a class constant and was wondering if there's a simpler syntax than using the $foo->__get below?
class Foo
{
const BAR = 'bar';
private $props = array( self::BAR => 'wee' );
public function __get($name)
{
return $this->props[$name];
}
}
$foo = new Foo();
echo $foo->__get(Foo::BAR);