Hi Lukas,

Lukas Smith wrote:

> Hi,
> 
> would it be possible to allow people to override the fixed name of
> __autoload() to a user defined function (static method?). I think this
> would be much more flexible and would probably also make it easier to
> exploit __autoload() inside class libraries. Especially as users are
> likely to use code from different class libraries.
> 
> Seems like a nice little addition for PHP 5.1 ...

Marcus recently added autoload stuff to SPL. I didn't test it, yet. But for
what i have seen he ads an stack of autoload functions where you can
register your own function with spl_autoload_register() there you should
also be able to enter some method (in array($object, 'method') oder
array('class', 'method') syntax. The functions in this stack are called one
after the other. 

Additionally he adds an standard autoload function which searchs for a file
$class.$extension in the includepath where $extension is by default inc
or .inc.php where you can register your own extension using 
spl_autoload_extensions()

Everything mainly from looking at the implementation and by taking a look at
Marcus' tests located at ext/spl/tests/spl_autoload_001.phpt and
spl_autoload_002.phpt hope someone corrects my failures ;-)

johannes
-- 
Johannes SchlÃter                           Mayflower GmbH / ThinkPHP
http://thinkphp.de                            http://blog.thinkphp.de

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to