I have written two class at two different file, for example file classA.php and classB.php, the file written below.
file classA.php
 class a {
      public function __construct() {
           require_once('classB.php');
           $classB = new b();
      }
 }
 $classA = new a();
file classB.php
 class b {
      public function __construct() {
          echo "Hello World!";
      }
 }
And the code work fine, and output Hello World! as well. But when I write both of the class like this
 class a {
     public function __construct() {
         class b {
             public function __construct() {
                 echo "Hello World!";
             }
         }
         $classB = new b();
     }
 }
 $classA = new a();
It showing an error
Fatal error: Class declarations may not be nested
Which i think both of them should be do the same thing, yesterday i found something about "arbitrary places" but i don't find the correct answer for what it is.
I just want to know why both of them, showing different result? or maybe something about include or require that i didn't know? 
NOTE
I'm not asking what the different between require() and include() functions 
 
     
     
    