Looking for a way to do Application Objects ([URL=http://www.w3schools.com/asp/asp_applications.asp]like that of ASP[/URL]). Not to sure if that would be the correct name for it in PHP… but you could also call them server-wide variables. I want to avoid using MySQL for these calculations.
@L0phtpDKauthorApr 30.2006 — #$_ENV and $_SERVER looks promising... I haven't run a test on them yet.
But... lets say I wanted to have an array of objects on my server's memory (ie: locations to characters on a game map... seen by all users/clients), what one would I use?
EDIT: to make better sense... if I had two scripts (A.php and B.php), which declaration would allow the both scripts to see the variable.
@rch10007Apr 30.2006 — #using $_SESSION['variable'] or $_COOKIE['variable'] would allow you to pass the variable to whatever page you wanted to. make sure to use session_start() at the top of any pages that use session variables.
@rch10007Apr 30.2006 — #go with $_SESSION[''] then, I was just pointing out the cookie variable in case you are going to need to pull info from an individual user. but if you don't need to pass info back and forth, don't.
@Daniel_TApr 30.2006 — #True - But these are global variables... All the users need the see the same data.[/QUOTE]Then perhaps this is betters suited to a text file (if you can't use MySQL)? I imagine you could have access to all users' data if you had their SESSIDs, but it wouldn't be very practical...
@L0phtpDKauthorApr 30.2006 — #That was another idea... but I'm looking for speed.
I think ASP may be the way to go on this one... because PHP just doesn't support this (with out a System V extension... which is [b]not[/b] available on Windows... )
@Daniel_TMay 01.2006 — #... but I'm looking for speed ... because PHP just doesn't support this[/QUOTE] You could simply write some functions to send/retrieve variables from files. This wouldn't be slower than ASP, because that's what ASP would be doing anyways. It has to be storing those varibales SOMEWHERE ? (hint: temp files)
Of COURSE i'm going to save it to an SQL database... but why flood it with a bunch of minute details when I could send it one large one (buffer the small details into a RAM)? Wouldn't that be more effecient? (and these are minor details... so if the data is lost, no big deal)
@Stephen_PhilbinMay 02.2006 — #If you're on a Windows box, they you'd probably be best using the .Net framework anyway.
If you're looking to reduce speed [i]that[/i] much and it's "no big deal" if these variables are lost, then I'd suggest you ditch them all together. It's just an unnecessary work for the systems resources.
If you're doing something like making an online multi player game (which is what it sounds like), then you don't want to be using either .Net or PHP. You'd want to be building a proper server application and client application in something like C/C++ (seeing as speed is of the essence) and have them connect via a stateful protocol (possibly also custom built).
I plan on doing that, but we're still prototyping so I'm trying to make the development time as quickly as possible (2 weeks from concept to release). This is only an attempt to gain more VC for the project.