I dissagree with that... I would like the option to say where my classes are. If i want multiple classes in one file then i can.
function myAutoLoader($className) { if (!class_exists($className)) { include("all_of_my_classes.php"); } } Making a classpath and ClassName.php files will make php horibly look like java. One of the reasons java does this is cause you can't have 2 public classes in one file. We shouldn't force php developers to use one class per file just to use the "auto-loading" feature. - brad --- Andi Gutmans <[EMAIL PROTECTED]> wrote: > I'd prefer not having a handler for autoloader. I'd prefer having the > Engine look for ClassName.php in the default include_path and if it doesn't > exist die... (i.e. not call any user-definable PHP function). > > Andi > > At 11:33 AM 6/10/2002 +0200, phpsurf wrote: > >this patch would be really great ! > > > >I can remember it has been discussed a lot on the ZE2 mailing list about the > >'import' feature. > >some people (and I was) would have apreciated another name because this name > >was already used in many PHP frameworks to implement a function that loads > >classes. > > > >As far as I followed this thread, the agreement was that the import keyword > >can be used fine for namespaces if a autoload statement was patched to the > >engine ... so everyone would be happy ! :) > > > >I guess your patch gives some function like this one : > >set_classautoload_handler("myAutoLoader"); > > > >and then, one can implement a function like this: > >myAutoLoader($className) { > > if (!class_exists($className)) { > > include("class/".str_replace("_", "/", $className).".php"); > > } > >} > > > >I'm sure many programmers would apreciate such a feature. > >Especially as it whould have no BC issue at all ! > > > > > -----Original Message----- > > > From: Ivan Ristic [mailto:[EMAIL PROTECTED]] > > > Sent: dimanche 9 juin 2002 22:46 > > > To: Zeev Suraski > > > Cc: [EMAIL PROTECTED] > > > Subject: Re: [PHP-DEV] REPOST: Class Autoloading [PATCH] > > > > > > > > > > I believe this has been discussed in the past and not ack'd, > > > please read > > > > the php-dev archives... > > > > > > I tried and I tried but I couldn't find a discussion on anything > > > similar on the mailing list. > > > > > > The code I sent is *already* in use, and has been in > > > use for some time now. Take a look at this message from > > > November 2001: > > > > > > http://marc.theaimsgroup.com/?l=php-dev&m=100687224711738&w=2 > > > > > > I didn't introduce anything new, so if it was OK then it should be > > > OK now. Also, the code cannot affect the people that are not using > > > the feature so I do not think that there will be any kind of impact > > > on the existing user base. > > > > > > This feature makes it possible to have one class per file and not > > > to worry about inclusion at all. It becomes especially useful when > > > used together with products such as Zend Accelerator, where files > > > are cached (and you do not have to worry about a large number of > > > small files). > > > > > > -- > > > Ivan Ristic, [EMAIL PROTECTED] > > > [ Weblog on PHP, Software development, Intranets, > > > and Knowledge Management: http://www.webkreator.com ] > > > > > > > > > -- > > > PHP Development Mailing List <http://www.php.net/> > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > >______________________________________________________________________________ > >ifrance.com, l'email gratuit le plus complet de l'Internet ! > >vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP... > >http://www.ifrance.com/_reloc/email.emailif > > > > > > > >-- > >PHP Development Mailing List <http://www.php.net/> > >To unsubscribe, visit: http://www.php.net/unsub.php > __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php