A complete example with namespaces:fruits/pinapple.php<?phpnamespace Fruits;echo "pinapple\n";class Pinapple { }?>fruits/pinapple.php<?phpnamespace Vegetables;use Fruits\Pinapple;echo "carrot\n";class Carrot { }new Pinapple(); // Let's call autoload here?>index.php<?phpspl_autoload_register(function($class_name) { @include_once(__DIR__ . '/' . strtolower(str_replace('\\', '/', $class_name)) . '.php');});new Vegetables\Carrot();?>Result:carrotpinappleindex2.php<?phpspl_autoload_register(function($class_name) { @include_once(__DIR__ . '/' . strtolower(str_replace('\\', '/', $class_name)) . '.php');});spl_autoload_call('Fruits\\Pinapple'); // Reverse the load orderspl_autoload_call('Fruits\\Pinapple'); // Multiple call is safe with include_oncenew Vegetables\Carrot();?>Result:pinapplecarrot