如果在OOPS PHP中以相反的顺序定义,则多级继承会给出错误

I am trying to test Multi level inheritance using 3 classes in reverse order as define below, giving me error of Class B not found.

class A extends B
{
  function area_a(){echo "A::hello";}
}
 class B extends C
{
    function area_c()
    {
        echo "hiiii";
    }
  function area_b(){echo "B::hello";}
}
 class C
{
     function area_c(){echo "C::hello";}
}
$obj=new A;
$obj->area_b();

It should work this way:

 <?php 
  class C {
     function area_c(){echo "C::hello";}
  }
  class B extends C{
     function area_c(){
        echo "hiiii";
     }
    function area_b(){echo "B::hello";}
  }

  class A extends B{
    function area_a(){echo "A::hello";}
  }



  $obj=new A;
  echo $obj->area_b();

Regarding the error, when the code is compiling, then it goes to class A and checks that it extends class B and searches above for class B and can't found, hence the error.