arrays in sessions, please!
| From: | Christian Dechery | Date: | Thu, 29 Mar 2001 18:10:23 +0000 |
| Subject: | arrays in sessions, please! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-46131@lists.php.net to get a copy of this message | ||
Why I can get this to work?
I don't understand... I made another simple script that the only thing it did was the "build array/serialize it/register the session var/ => next page load unserialize it into array/update array/serialize it again".. and it worked like a charm...
I'm doing the exact same thing here but step_times gets registered empty... and script_total_time is OK...
and the weirdest part is that, when I uncomment the "echo ...", it displays perfectly the contents of $step_times as a string...
PLEASE?!?!?!
<pre>
if(!isset($script_total_time))
{
$script_total_time=(float)$total_time;
session_register("script_total_time");
$step_times_array[$step]=(float)$total_time;
$step_times=serialize($step_times_array);
//echo "step_times=\"$step_times\"";
session_register("step_times");
}
else
{
$script_total_time+=(float)$total_time;
$step_times_array=unserialize($step_times);
$step_times_array[$step]=(float)$total_time;
$step_times=serialize($step_times_array);
}
</pre>