Share on Google+Share on Google+

PHP Autoload

Ads
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

 

Advertisements

Posted on: February 19, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Ads

Advertisement