Home Tutorial Php Phpoop PHP Autoload

 
 

Share on Google+Share on Google+
PHP Autoload
Posted on: February 19, 2010 at 12:00 AM
Advertisement
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

 

Advertisement

Related Tags for PHP Autoload :


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.

Posted on: February 19, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com