title: Access child class static variables from parent class?
body: <p>I have a base class that I need to call functions on a class that is referenced in the child class.</p>
  
  <p>Easy enough,</p>
  
  <pre><code>class base_class {
  
      public function doSomethingWithReference(){
          $this-&gt;reference-&gt;doSomething();
      }
  }
  
  class extended_class extends base_class{
  
      protected $reference;
  
      public function __construct($ref){
          $this-&gt;reference = $ref;
      }
  }
  </code></pre>
  
  <p>Now this works fine obviously,</p>
  
  <p>But, when I am debugging I don't care about the value of <code>$this-&gt;reference</code></p>
  
  <p>But, the object that <code>$this-&gt;reference</code> refers to is huge!</p>
  
  <p>so, when I do <code>print_r($instanceOfExtendedClass)</code> I get the print out of that object.</p>
  
  <p>Now the reference is different for each class that extends <code>base_class</code>.</p>
  
  <p>What I wanted to do was just set <code>reference</code> as a static property on the <code>extended_class</code> class.</p>
  
  <p>But, then changing <code>doSomethingWithReference</code> to be <code>self::$reference</code> throws an undefined variable error.</p>
  
  <p>And conversely setting the static variable in <code>base_class</code> and modifying it from <code>extended_class</code> doesn't work as it changes the variable for all everything that extends from that class.</p>
  
  <p>Is there any way to do this so I don't get the print out of <code>$this-&gt;reference</code>?</p>