__autoload(string $className) — Attempt to load undefined class
This autoload
function call when we will try to create instance of undefined class.
Like
here we don’t have class A in index.php. If in index.php file we don’t
have __autoload function
We will
can get error. But because of this function we can load file for class A
index.php
<?phpfunction __autoload($className){ $filename = "./". $className .".php"; include_once($filename);}
$obj = new A();?>
A.php
<?php class A { public function __construct() { echo "TEST"; return $this } }?>
I have too much difficulty to load file but because of this article I can easily load file.
ReplyDeleteThis is very very help to me in my project.
Thank you very much for this article.
yes its very helpful article
ReplyDeleteThank u
ReplyDelete