title: How do I call PHP parent methods from within an inherited method?
body: <p>In PHP, I'm trying to reference a method defined in an object's parent class, from a method inherited from the object's parent class.  Here's the code:</p>
  
  <pre><code>class base_class {
    function do_something() {
      print "base_class::do_something()\n";
    }
    function inherit_this() {
      parent::do_something();
    }
  }
  class middle_class extends base_class {
    function do_something() {
      print "middle_class::do_something()\n";
    }
  }
  class top_class extends middle_class {
    function do_something() {
      print "top_class::do_something()\n";
      $this-&gt;inherit_this();
    }
  }
  
  $obj = new top_class;
  $obj-&gt;do_something();
  </code></pre>
  
  <p>The problem is that parent::do_something() in inherit_this() tries to find the parent class of base_class, not the parent of the object's actual class, and the example above throws an error.  Is there something I can write instead of parent::do_something() that would call middle_class::do_something(), and that would still work even in classes that extend (say) top_class?</p>