Hi all,
Here is my problem. In my file I have an __autoload function and it is called as long as classes are called from the file the __autoload function is placed in. But if I include a file in the file which __autoload is placed and try to call a class __autoload is not called.
Example:
file.php
function __autoload($class)
{
$file[0] = $_SERVER['DOCUMENT_ROOT'].'/_global/classes/'.$class.'.php';
$file[1] = $_SERVER['DOCUMENT_ROOT'].'/_global/models/'.$class.'.php';
if (file_exists($file[0]))
{
require_once($file[0]);
} elseif(file_exists($file[1])) {
require_once($file[1]);
} else {
return false;
}
}
// Works
$error = new Error();
// Included File
include('test.php');
test.php
// Does not work even if Bar.php exists.
$foo = new Bar();
Does anyone know what is causing this or has anyone had this problem before? I am developing on WAMP if that has any effect.
Thanks,
Darren