NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP5 Static Classes

Daniel Convissor danielc at analysisandsolutions.com
Wed Feb 2 13:20:35 EST 2005


Joseph:

On Wed, Feb 02, 2005 at 12:08:11PM -0500, Joseph Crawford wrote:
> Can anyone here explain or point me to a good description of what a
> static class is.

I didn't read your whole inquiry, but let's answer what I think you're 
asking.

Static has to do with how it can be used.  In object oriented programming, 
when using a class, one normally instantiates a class into an object 
variable, like this:

  $o = new SomeClass();
  $o->someMethod();

But, when a class is being used statically, you can use the method 
directly:

  SomeClass::someMethod();

But, be aware that functionality is limited when using classes statically 
because $this is not available inside the methods.

http://us3.php.net/manual/en/language.oop5.static.php

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409



More information about the talk mailing list