CodeIgniter Forums
Can I create, and then add values, to an existing array, using the Session Class? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Can I create, and then add values, to an existing array, using the Session Class? (/showthread.php?tid=45970)



Can I create, and then add values, to an existing array, using the Session Class? - El Forum - 10-12-2011

[eluser]callumd[/eluser]
Eg, I'd like to be able to do the equivalent of this:

Code:
$_SESSION['some_value'][] = 'Adding a numerically indexed value to the some_value array';

** some other code **

And then this:

Code:
$_SESSION['some_value'][] = 'Adding yet another value to the some_value array';

I want to be able to add these values at any time, not all in one hit by passing a single array to the session class, eg:
Code:
$this->session->set_userdata($some_array);

Thanks.