PHP Autoload

To make the developer simpler, PHP 5 introduces a global-scope function__autoload() that will automatically satisfy class dependencies at run time.

Source Class

<?php class foo { public $bar; } ?>

Main Script

function __autoload($classname) {
    $classes = array('foo' => 'obj_autoload2.php');


$a = new foo();
/* since the class foo is undeclared, PHP will execute the __autoload()
 * function and using the class name try to perform an operation that will
 * ideally result in the declaration of the class */

Loading ...

Related Results :

  1. PHP Autoload
Note :
  • Related Posts are generally User Blog posts.
  • or Other tutorials from other networks of
  • Any registered user can create related posts based on search term tags.

About the Author