Autoload: As its name denote autoload is property of a OOP that enable to load a class dynamically. It means when you create an object of class, It will called __autoload function that include file.
See in below example
if you have "MyClass1.php" and "MyClass2.php" in same directory, it will include automatically else will generate error.
See in below example
function __autoload($class_name) { include $class_name . '.php'; } $obj = new MyClass1(); $obj2 = new MyClass2();
if you have "MyClass1.php" and "MyClass2.php" in same directory, it will include automatically else will generate error.
No comments:
Post a Comment