Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 03:54 AM
Jerry
Guest
 
Posts: n/a
Default 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.




  #2  
Old July 17th, 2005, 03:54 AM
Pedro Graca
Guest
 
Posts: n/a
Default Re: Arrays in SESSION vars ????

Jerry wrote:[color=blue]
> 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.[/color]


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 =--
  #3  
Old July 17th, 2005, 03:54 AM
Jon Kraft
Guest
 
Posts: n/a
Default Re: Arrays in SESSION vars ????

Jerry <none@none.com> wrote:
[color=blue]
> Can an array be stored in a session variable????[/color]

Please don't multipost.

Cheers;
JOn
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,414 network members.