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
https://forums.phpfreaks.com/topic/73096-solved-memory-used-by-session-variables/
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?

Archived

This topic is now archived and is closed to further replies.

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