hello is there any diffrence useing this excepts that we can use our own name auto load? is there any performance difference? how do they internally work?
between
function __autoload_libraries($class){
include_once 'lib.'.$class.'.php';
}
spl_autoload_register('__autoload_libraries');
vs
function __autoload($class){
include_once 'lib.'.$class.'.php';
}
__autoloadis generally considered obsolete. It only allows for a single autoloader. Generally you should only use__autoloadif you’re using a version of PHP without support forspl_autload_register.spl_autoload_registerallows several autoloaders to be registered which will be run through in turn until a matching class/interface/trait is found and loaded, or until all autoloading options have been exhausted. This means that if you’re using framework code or other third party libraries that implement their own autoloaders you don’t have to worry about yours causing conflicts.UPDATE:
__autoloadis now officially deprecated as of PHP 7.2.0, which means it’s now on the chopping block. If you want your code to be compatible with future versions of PHP you definitely should not use__autoload