B.php:
class B
{
function show() { echo 'works'; }
}
A.php
class A
{
public static function defineB()
{
include "b.php";
}
}
A::defineB();
$b = new B;
var_dump($b);
object(B)#1 (0) { } ,
if without A::defineB(); - Fatal error: Class 'B' not found , if define class without including another file - Fatal error: Class declarations may not be nested ,
is it bug ?