1
名前がconstに格納されているプロパティにアクセスしたいとします。PHPでconstに格納されているプロパティ名を使用
class Foo
{
const PROPERTY_NAME = 'bar';
protected $bar;
public function getBar() {
return $this->self::PROPERTY_NAME;
}
}
これはどのように行うのですか?