Page 1 of 1

How to __autoload classes, interfaces, functions

Posted: Wed Aug 12, 2009 3:42 pm
by ctrLogicDotNet
Here is the thing,

I read about the __autoload magic function and wanted to know if in this function there would be a way to know if what it tries to __autoload is a class, an interface, a function (even though I think it's not called upon an unfound function)...

Each of these in my implementation are found in different paths, so to require them I would need to have access to this information...

Thank You

Re: How to __autoload classes, interfaces, functions

Posted: Wed Aug 12, 2009 4:02 pm
by solid
It doesn't matter, simply check both paths in the __autoload function:

Code: Select all

 
if (file_exists($file_path_a))
{
     require_once($file_path_a);
}
elseif (file_exists($file_path_b))
{
     require_once($file_path_b);
}