For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > March 2008 > is it possible to use autoload for interfaces ?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author is it possible to use autoload for interfaces ?
Pugi!

2008-03-25, 7:08 pm

Is it possible to use __autoload for interfaces as well ?

if file exists ($path . '/class.$name.php'
require class
else if file exists ($path . '/interface.$name.php'
require interface
else
throw exception

Pugi!
Michael Fesser

2008-03-25, 7:08 pm

..oO(Pugi!)

>Is it possible to use __autoload for interfaces as well ?


Sure.

But you should have a look at spl_autoload_register() instead. It's the
more portable way for autoloading, especially if you want to use third-
party scripts that might already have their own __autoload() function.

Micha
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com