Array not completed in PHP session

I had problems with confusion for several days. I store an array with 10 to 50 elements in an array of sessions.

$_SESSION['my_array'] = erg_array;

Then I will send the form to another page. On the new page, I read the array, and there are only a few elements left in the array. Sometimes there are 2 or 3 or 4 elements in an array.

If I look in the session file on the server, the array will not be populated in the file. At the end of my page I check the array

print_r($_SESSION['my_array']);

and 50 items will be printed. This is the last line of code. Only 3 items are stored in my session server file.

Does anyone have an idea where to look?


Edit:

If I serialize my array as follows

$_SESSION['my_array_string'] = base64_encode(serialize($_SESSION['my_array'));

and with another script

$_SESSION['my_array'] = unserialize(base64_decode($_SESSION['my_array_string']));

is the array complete?

+4
source share
1

$_SESSION ['my_array'] . ...

$array [] = $_SESSION ['my_array']; , .

$_ SESSION ['my_array_string'] = base64_encode (serialize ($ array []));

.

0

All Articles