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

Relevant code:


// The factory class for the image class.
class Images
{

...

    public static function imageCount ($client, $db, $line, $file)
    {


PHP verson is Version 5.1.4.

Thanks

-- 

Charles Curley                  /"\    ASCII Ribbon Campaign
Looking for fine software       \ /    Respect for open standards
and/or writing?                  X     No HTML/RTF in email
http://www.charlescurley.com    / \    No M$ Word docs in email

Key fingerprint = CE5C 6645 A45A 64E4 94C0  809C FFF6 4C48 4ECD DFDB

Attachment: pgpI9vkS1jm0O.pgp
Description: PGP signature

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to