Re: class packages

From: Date: Wed, 08 Sep 2004 14:56:04 +0000
Subject: Re: class packages
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-196130@lists.php.net to get a copy of this message
> As far as I can tell there is not an easy way yet to create packages in > PHP5. > > It seems the following is the best option: > include('classes/help/Search.inc'); > > // Inside Search.inc and in the same "package" > include('OtherClass.inc'); > include('AnotherClass.inc'); > > Is there a better way? > > Thanks! > Not really... That is about it. PHP does not offer a way to group classes, scripts, and functions into logical "packages" or "applications" like some other languages do (asp comes to mind (and no, I'm not an asp advocate)). However, while it's common to save each class in its own file, it isn't at all uncommon to have multiple classes in a single file - especially if they are typically used together like parent and extended classes or interfaces and implementations. This method will also save disk io by only having to include one file. Jim Grill

« previous php.general (#196130) next »