On Fri, 2007-08-31 at 15:34 -0600, Charles Curley wrote: > I'd like to build a factory class (all static methods) called Images > that will that create, store, etc. instances of another class, > Image. I can create image and Images, but I have to instantiate Images > in order to call a factory method. This works: > > > $snark = new Images (); > $countImages = $snark->imageCount ($client_id, $db, __LINE__, __FILE__); > > > but this does not: > > $countImages = $Images->imageCount ($client_id, $db, __LINE__, __FILE__); > > The docs say the second should work: > > Declaring class members or methods as static makes them accessible > without needing an instantiation of the class. A member declared as > static can not be accessed with an instantiated class object (though > a static method can). > > http://www.php.net/manual/en/language.oop5.static.php
Your problem is probably your syntax in calling the static function. $countImages = Images::imageCount($client_id, $db, __LINE__, __FILE__); --lonnie PS. I copied this message to the UPHPU group. Lots of great PHP devs there. http://uphpu.org/ /* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */
