NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP5 Static Classes

Joseph Crawford codebowl at gmail.com
Wed Feb 2 12:08:11 EST 2005


Can anyone here explain or point me to a good description of what a
static class is.

My assumption is that it is an instance of a class that will be
available for many users on the site, say user a goes to the site,
they can use the static class, it increments users to 3 then user a
leaves the site, the object still exists, user b goes to the site and
it increments users to 4 etc...

i have been told by a few people that static classes are only static
while that one user is on the site, so each user get's thier own
static object.

here is what i am thinking.

I have been wanting to create an online game such as worldofhatred.com
and pimpkane.com but i wanted to make my game much more in depth and
maybe create a framework that can be used for many games at one time.

the underlying engine would need to be a static class so that it could
keep track of how many players are playing, game settings etc...

if the object is created with each user visit this will not work,
however if it is created when the very first person goes to the site
and stays going after the very last person leaves (basically until i
tell it to destroy) then this could work

-- 
Joseph Crawford Jr.
Codebowl Solutions
codebowl at gmail.com



More information about the talk mailing list