PHP SESSEION HELP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cjconnor24
Forum Newbie
Posts: 13
Joined: Wed Oct 29, 2008 6:31 am

PHP SESSEION HELP

Post by cjconnor24 »

Hi all,

Could someone please clarify something to do with php sessions please.

i often see:

Code: Select all

$aNewVar = $_SESSION['theSessionName'][color=#FF0000][b]['somethingelse'][/b][/color];
what do the the second set of square brackets do?

thanks in advance
c
User avatar
novice4eva
Forum Contributor
Posts: 327
Joined: Thu Mar 29, 2007 3:48 am
Location: Nepal

Re: PHP SESSEION HELP

Post by novice4eva »

Think of it as a 2d array. well somewhere session could have been set like this(1 of 1000 ways )

Code: Select all

 
$mysessionValues = array('somethingelse'=>'my bike','replaceBy'=>'new yamaha bike');
$_SESSION['theSessionName'] = $mysessionValues;
$aNewVar = $_SESSION['theSessionName']['somethingelse'];//$aNewVar = my bike
 
Post Reply