Cannot access class constant from an instance
<p>I hit a strange problem today and even as a PHP engineer i'm stumped at this:</p>

<p>It seems you can access a class constant from an object instance such as:</p>

<pre><code>class a {
    const abc = 1;
}
$a = new a();
var_dump($a-&gt;abc);
</code></pre>

<p>This will output null instead of the expected 1. I was able to do the following:</p>

<pre><code>class a {
    const abc = 1;
}
$a = new a();
var_dump(a::abc);
</code></pre>

<p>But in the context of a sub object that doesn't really know who the parent is exactly, i find it extremely annoying to do:</p>

<pre><code>class a {
    const abc = 1;
}
$a = new a();
$c = get_class($a);
var_dump($c::abc);
</code></pre>

<p>Is it me or this is completly stupid, if not, please enlighten me why its working that way.</p>

<p><strong>EDIT</strong></p>

<p>Another way of doing it but it's not really better:</p>

<pre><code>class a {
    const abc = 1;
}
class b {
    public function getA(){
        return new a();
    }
}
$b = new b();
$c = $b-&gt;getA();
var_dump($c::abc);
</code></pre>

<p>This last example works more like what i am doing and experiencing...</p>
