Jump to content

[SOLVED] Memory used by session variables


incubus

Recommended Posts

Hi all - newbie here.

I have an HTML form and am storing the values the user enters in session variables so they can persist between pages (the form is over 3 html pages). All in all, there will be around 45 values stored like so:

 

$myVar = $_POST['myVar'];
$_SESSION(myVar) = $myVar;

 

Will this have a detrimental effect on performance? How much memory is available to the session to store variables? Would it make a difference if there were lots of users doing the same thing?

 

Would I be better putting all the form values into a large array, and then just storing the array in the session? That is:

 

$myArray = array();
$myArray[0] = $_POST['myVar'];

$_SESSION(myArray) = $myArray;

 

Hope this makes sense, thanks for looking.

Link to comment
Share on other sites

Session values are stored on disk, not in memory. generally speaking you need'nt worry about such things too much.

 

Great, thanks.

 

Just from a best practise point of view, would it make a difference if the variables were stored in an array which was then itself stored in the session?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.