title: Using class constants and overriding in PHP
body: <p>If I have a class structure with a value that can either be true or false, that doesn't change, currently implemented as variables would it be better to change them to constants, such as:</p>
  
  <pre><code>class Parent {
      const BOOL_CONST = false;
  
      ...
  }
  
  class SomeChild extends Parent {
      const BOOL_CONST = true;
  
      ...
  }
  </code></pre>
  
  <p>Later I have an object which may be of any type in that class hierarchy, either the parent or one of its children, and some of the children may, like 'SomeChild' have overloaded the value to be true.</p>
  
  <p>Is there some way I can access the constant without knowing the class?  In other words can I do something like:</p>
  
  <pre><code>$object-&gt;BOOL_CONST
  </code></pre>
  
  <p>Or would it be better to leave these values as variables, even though they really shouldn't change?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I've reworded my question above to better express what I was attempting to ask.</p>