I cannot find a written rule for this, but after seeing the result of this:
<?php //A1 Exists echo class_exists("A1")?"A1 Exists<br>":"A1 Not exists<br>"; //B1 Not exists echo class_exists("B1")?"B1 Exists<br>":"B1 Not exists<br>"; //C1 Not exists echo class_exists("C1")?"C1 Exists<br>":"C1 Not exists<br>"; class C1 extends B1 {}; class B1 extends A1{ }; class A1 { }; ?>
I can understand that the interpreter can look back and forth to look for the parent class, but when you link the third level of inheritance, it cannot predict that B1 will exist.
If you do:
<?php //A1 Exists echo class_exists("A1")?"A1 Exists<br>":"A1 Not exists<br>"; //B1 Not exists class B1 extends A1{ }; class A1 { }; ?>
It says: "Well, I havenโt seen an A1 class announcement before, but I can see that itโs ahead."
source share