title: How to access method in classes parent if it has a parent?
body: <p>Is it possible to check if a given class has a parent, and if so, then execute a method in the parent?  Below is my attempt, but as seen, will throw an error since <code>parentClass</code> doesn't have a parent.  Yes, I know that I can just change <code>parentClass::myMethod()</code> to just return <code>true</code> since it doesn't have a parent, but am curious how PHP handles this. Thanks</p>
  
  <pre><code>$obj=new childClass();
  $rs=$obj-&gt;myMethod();
  
  abstract class parentClass
  {
      public function myMethod()
      {
          //This next line will throw an error since this class does not have a parent
          return (get_parent_class($this)?parent::myMethod():true);
      }
  }
  
  class childClass extends parentClass
  {
      public function myMethod()
      {
          return (get_parent_class($this)?parent::myMethod():true);
      }
  }
  </code></pre>