Forum Moderators: coopster
This is only for PHP5, correct?
Yes.
Here's an example, taken from the documentation [us3.php.net]:
<?php
#this autoload function gets called if the script cannot find the class definition
function __autoload($class_name) {
require_once $class_name . '.php'; #includes the class
}$obj = new MyClass1();
$obj2 = new MyClass2();
?>
__autoload will work, and no other function (unless you call that function within the autoload one).