__autoload( ) is called whenever you try to create an object of a class that hasn't been defined : __autoload « Class « PHP






__autoload( ) is called whenever you try to create an object of a class that hasn't been defined

 
<?
    function __autoload($Class) {
            print "Bar class name: $Class!\n";
            include "barclass.php";
    }

    $foo = new Bar;
    $foo->wombat( );
?>
  
  








Related examples in the same category

1.Creating an __autoload() Function
2.Automatically Loading Include Files with ___autoload()
3.__autoload() function automatically includes a class file.
4.Using the __autoload() Function