Re: Class auto-loader
| From: | Andi Gutmans | Date: | Sat, 24 Jun 2000 18:15:36 +0000 |
| Subject: | Re: Class auto-loader | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-22239@lists.php.net to get a copy of this message | ||
I personally am not a fan of this kind of functionality.
I don't like magic happening behind the scenes and prefer the source code to contain the necessary code.
Andi
At 09:05 PM 6/24/00 +0300, Stanislav Malyshev wrote:
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) {--- Andi Gutmans <andi@zend.com> http://www.zend.com/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