muze Posted December 17, 2010 Share Posted December 17, 2010 I'm trying to pass variables among many pages, in an interactive choose your own adventure game. I created the entire thing using sessions, and everything works as intended, but during high traffic there is much slowdown. I had memcached installed and that helped the slowdown considerably but it's still slowing down the site when there is a lot of traffic. I've been told using session arrays, instead of all these individual sessions, will help alleviate the server load. So I don't know if that's true or not, but I'd like to get the correct syntax for using these session arrays. First question - is it absolutely necessary to call the array() ? $_SESSION['game']=array(); Or if this is two separate sessions - $_SESSION['stairs'] = "true"; $_SESSION['dance'] = "true"; Is this two parts of one session array? $_SESSION['game']["stairs"]="true"; $_SESSION['game']["dance"]="true"; And in that case, do I need to call the array() ? I'm seeing different examples of session arrays online so I'm trying to get this clarified. Thanks. PS The purpose of the sessions is that I need them to be checked many pages later in the game in many cases. And I can't just add all the parts of the array at once, which is why I create an empty array first, to have items added as necessary as a user progresses through the game. Link to comment https://forums.phpfreaks.com/topic/221940-session-arrays/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.