![]() |
simple session question
Hi.
Can I set $_SESSION['something'] to the value of an array? PHP Code:
??? |
anyways i dident read your question corectly
now i get what you where asking.. and yes you can set a session to the value of an array. as tlcandres said sorry once again :P |
yes you can set a session to the value of an array.
|
Thanks :)
|
To the array itself? Your code will work. One question though, why didn't you just run it yourself and see? Just curious.
|
I could be wrong, but wouldn't assigning the array to the session just be a pointer? You couldn't use it on another page since its stored in the ram which is deleted at the end of th pages execution. I know in C/++ (what php is made in), the root variable for an array is a pointer.
Or on the off chance that that memory address is being used by the time you go the next page it displays that. :-) |
In reply to Village Idiot's post, session variables are serialized (ie, formatted into one long string) before being stored physically (in the file system, database, etc.). Some types of variables can't be stored in sessions -- things that can't be serialized -- such as resources or objects with circular references, but most variable types have no problem being saved as session data.
|
Ah, I see.
|
| All times are GMT. The time now is 02:45 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0