Hello i have a task to do to class the classes by its namespace. My requirement is to load the classes without including the require keyword for autoload.php.
<?php
namespace classes;
class test {
public function getPrint(){
echo "Hello";
}
}
This is the class with namespace. Here is the code for to class functions.
require_once 'classes/autoload.php';
use classes\test2;
$dt = new test();
$dt2 = new test2();
$dt->getPrint();
echo $dt2->Okay();
I am autoloading the classes. my problem is to load the classes with using
require_once 'classes/autoload.php';
This line. I have to use this line in every code file to load the classes. What is the proper way to load the classes. So i do not have to include
require_once 'classes/autoload.php';
this in every file?