Why can a PHP class be defined before it's parent but not if its parent implements an interface?
<p>I came across this behaviour in PHP and I'm not sure why it works this way.  If you define a class which extends another class, the parent class can be defined after the child and it still compiles:</p>

<pre><code>class SubClass extends SuperClass {
    public function doSomething() {}
}

abstract class SuperClass {

}
</code></pre>

<p>But... if the parent class implements an interface:</p>

<pre><code>interface Inter {
    public function doSomething();
}

class SubClass extends SuperClass {
    public function doSomething() {}
}

abstract class SuperClass implements Inter {

}
</code></pre>

<p>It no longer compiles, when PHP tries to parse the SubClass definition it fails, you have to move the super class definition above the sub class definition.</p>

<p>If instead of implementing an interface the SuperClass extends another class it also works:</p>

<pre><code>abstract class SuperSuperClass {
    public abstract function doSomething();
}

class SubClass extends SuperClass {
    public function doSomething() {}
}

abstract class SuperClass extends SuperSuperClass {

}
</code></pre>

<p>So my question is, why is PHP able to resolve SuperClass in the first/third examples when it comes to compile SubClass, but isn't able to do so in the 2nd example where the SuperClass implements an interface.</p>