PHP __autoload() Errors

Some of you may have experienced problems when using

__autoload()

in multiple scripts. So, the better way is to avoid

__autoload()

and use

spl_register_autoload()

instead. If you have written this already, just rename your function to something like

__autoload_my_classes

, and in the next, call

spl_autoload_register

as:

    <?php
function __autoload_my_classes($classname)
{
  # ... your logic to include classes here
}
spl_autoload_register('__autoload_my_classes');
?>

By calling it repeatedly with different function names, you can assign multiple functions to

spl_autoload_register()

. Be sure to limit your every function to include a CLASS file.

All PHP Scripts on this website are provided by phpscripts4u.com where you can find all the latest PHP code snippets, plugins and libraries.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>