Re: Class auto-loader
| From: | Sterling Hughes | Date: | Sat, 24 Jun 2000 21:13:02 +0000 |
| Subject: | Re: Class auto-loader | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-22238@lists.php.net to get a copy of this message | ||
I like the idea a lot (and if I dare say it +1).
Sterling
> Here on the list someone brought the idea of auto-loading classes on
> demand. Attached is the patch that allows to do this. Please comment on
> it. If you like the idea, I'll extend it (as to providing convenient
> standard auto-loader, probably entering auto-loader into configure,
> hooking it to various places like sessions, etc.) to be fully usable.
>
> Example usage:
>
>
> function load($class) {
> var_dump($class);
> if($class == "foo") {
> include("foo.inc");
> return true;
> }
> return false;
> }
> set_class_loader("load");
> $x = new foo;
> ?>
>
> In foo.inc:
>
> <?
> class foo {
> function wow() { echo "wow!"; }
> }
> ?>
>
> --
> Stanislav Malyshev stas@zend.com
> +972-3-6139665
>
>
>
----------------------------------------------------------------------------
----
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: php-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net