Strange __autoload() Script Behaviour

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All

I have 4 PHP scripts written to run in a website. Each has different
functionality and they are not related in any way except that they all
use objects.

Each script contains require('autoLoadClasses.php');  to load classes as
required.

The autoloader script 'autoLoadClasses.php' that is called by each of
the four scripts script is:

function __autoload($class_name)
{
require('classes/class_' . $class_name . '.php');
}

Then it gets strange. The first three scripts run fine - no problems,
objects get created  and are utilised as expected

But the fourth script produces the following error message:

Fatal error: Cannot redeclare __autoload() (previously declared in
D:\Webdesign\Websites\InsightCGC\autoLoadClasses.php:2) in
D:\Webdesign\Websites\InsightCGC\autoLoadClasses.php  on line 5

So, the same 'require' instruction calling the same 'required' script
but resulting in two different outcomes. Driving me crazy so any
solution(s) to this problem would be much appreciated.

Thanks in advance

Mark


[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux