NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP5 Static Classes

Dan Cech dcech at phpwerx.net
Wed Feb 2 14:07:47 EST 2005


Joseph Crawford wrote:
> 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.

Fair enough.

> 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...

This is what a database is for.

> 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

All you need to do is store the data you want to be global in the 
database and access it from each client.  So long as you write your SQL 
to avoid problems with concurrent users this will work 100% fine.

Dan



More information about the talk mailing list