I just did a bit of Research about Optimizing my PHP Code. In my Code Im using this function to include all classes I require:
function __autoload($class_name){
require_once "system/classes/".strtolower($class_name).".php";
}
Now I have read, that Magic functions or whatever __autoload
is called should be avoided.
And also that require_once
is really slow commpared to a simple include
.
I wondered if there is an alternativ to __autoload
or whats the best way to modyfy this function.
Is there a Speed Difference between require
and include
?
Thaks in advance for your suggestions!
EDIT: Does iit also make sens to Cache or precompile the classes?