470,815 Members | 1,147 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

Arrays in SESSION vars ????

Hi there:

A quick question, if anybody can give me a helping hand?

Can an array be stored in a session variable???? Or will the variable
of the type $_SESSION[...] hold scalar values only?
My attempts failed but that's probably because I did "something" wrong
:-).
I just wanted to be sure before I break my head over something
impossible.

Your answers are greatly appreciated.
Thanks and greetings.

Jul 17 '05 #1
2 4334
Jerry wrote:
Hi there:

A quick question, if anybody can give me a helping hand?

Can an array be stored in a session variable???? Or will the variable
of the type $_SESSION[...] hold scalar values only?
My attempts failed but that's probably because I did "something" wrong
:-).
I just wanted to be sure before I break my head over something
impossible.

Yes, it is very possible :)

<?php
session_start();
$_SESSION['user']['name']['first'] = 'Pedro';
$_SESSION['user']['name']['last'] = 'Graca';
$_SESSION['user']['country'] = 'Portugal';
// ...
$array = $_SESSION['user'];
echo '<pre>'; print_r($array); echo '</pre>';
?>
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #2
Jerry <no**@none.com> wrote:
Can an array be stored in a session variable????


Please don't multipost.

Cheers;
JOn
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by james | last post: by
8 posts views Thread by ndsoumah | last post: by
19 posts views Thread by Paul Yanzick | last post: by
3 posts views Thread by Mark | last post: by
5 posts views Thread by VB Programmer | last post: by
13 posts views Thread by Alexander Widera | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.