title: Overriding class constants vs properties
body: <p>I would like to better understand why, in the scenario below, there is a difference in the way class constants are inherited vs. instance variables.</p>
  
  <pre><code>&lt;?php
  class ParentClass {
      const TEST = "ONE";
      protected $test = "ONE";
  
      public function showTest(){
          echo self::TEST;
          echo $this-&gt;test;
      }
  }
  
  class ChildClass extends ParentClass {
      const TEST = "TWO";
      protected $test = "TWO";
  
      public function myTest(){
          echo self::TEST;
          echo $this-&gt;test;
      }
  }
  
  $child = new ChildClass();
  $child-&gt;myTest();
  $child-&gt;showTest();
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>TWO
  TWO
  ONE
  TWO
  </code></pre>
  
  <p>In the code above, ChildClass does not have a showTest() method, so the ParentClass showTest() method is used by inheritance. The results show that since the method is executing on the ParentClass, the ParentClass version of the TEST constant is being evaluated, whereas because it's evaluating within the ChildClass context via inheritance, the ChildClass member variable $test is being evaluated.</p>
  
  <p>I've read the documentation, but can't seem to see any mention of this nuance. Can anyone shed some light for me?</p>