What is autoload in php?

DEVOPS picture DEVOPS · Aug 31, 2010 · Viewed 62.8k times · Source

what is autoload in PHP?

Answer

osm picture osm · Aug 31, 2010

This will be of help to you about usage of autoload. http://ditio.net/2008/11/13/php-autoload-best-practices/

It's a magic function that helps you include / require files using class name.

function __autoload($class_name) 
{
    require_once $DOCUMENT_ROOT . “/classes/” . $class_name .“.php”;
}

It's deprecated at PHP 7.2.0 and spl_autoload_register is recommended for that purpose.