I don't really understand why you are looping through things there.  A
simple unserialize() on everything after the session_name| part will work
just fine on arrays and everything else as well.

-Rasmus

On Wed, 26 Nov 2003, Andrew Warner wrote:

> I have a script that browses a sessions table and extracts and
> displays the session values for display.  The function below (I don't
> remember where I got it) extracts session data without starting a
> session, but it doesn't handle session values that are arrays.
> Anyone have something like this that works?
>
>
>
> function sess_string_to_array($sd)
> {
>     $sess_array = array();
>     $vars = preg_split('/[;}]/', $sd);
>
>     for ($i=0; $i < sizeof($vars); $i++)
>     {
>        $parts = explode('|', $vars[$i]);
>        $key = $parts[0];
>        $val = unserialize($parts[1].";");
>
>        $sess_array[$key] = $val;
>     }
>
>     return $sess_array;
> }
>
>
> aw
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to