Home Tutorial Php Phpoop PHP Autoload

 
 

PHP Autoload
Posted on: February 19, 2010 at 12:00 AM
It is very common in PHP programming that we need to write long listing of files which has to be include in a single file. It is indeed a hectic job for each PHP programmer.

PHP Autoloading Classes:

It is very common in PHP programming that we need to write long listing of files which has to be include in a single file. It is indeed a hectic job for each PHP programmer.

But with the advent of PHP 5.0, this is not necessary anymore. We can define an   _autoload function to call automatically the class/interface which has not been defined yet.

 

PHP Autoload Class Example:

<?php

function _autoload($classname){

require_once $classname.'.php';

}

$obj=new mysqli();

?>

 

No Output will be generated

 

Related Tags for PHP Autoload :


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.