Class autoload patch

From: Date: Mon, 03 Jun 2002 13:02:23 +0000
Subject: Class autoload patch
Groups: php.dev 
Request: Send a blank email to php-dev+get-84768@lists.php.net to get a copy of this message
I have written this small patch to support class autoloading. It is written in the spirit of the unserialize callback (see http://www.php.net/manual/en/function.unserialize.php) and uses the same callback function. Can someone with write access to CVS please commit the patch? I assume that this is a safe thing to do because the same mechanism is already in use in the production code. Example: function _autoload($classname) { @include_once("class.$classname.php"); } ini_set("unserialize_callback_func", "_autoload"); // the following will work even if class X has // not be defined so far $x = new X(); -- Ivan Ristic, ivanr@webkreator.com [ Weblog on PHP, Software development, Intranets, and Knowledge Management: http://www.webkreator.com ]

« previous php.dev (#84768) next »