Jump to content

creating a multi dimensional array


purencool

Recommended Posts

I have four different arrays and I want to place them into a multi dimensional array and

then I want to place it into a Session variable. This is what I have below.How do I do this?

 

when I print_r($_Session) I don't get anything just option[](2);

 

 


$_SESSION ['option']['green'] = array('name '=>'jeff');
$_SESSION ['option']['red'] = array('name '=>'mary');
$_SESSION ['option']['blue'] = array('name '=>'joe');
$_SESSION ['option']['brown'] = array('name '=>'ash');

Link to comment
https://forums.phpfreaks.com/topic/215850-creating-a-multi-dimensional-array/
Share on other sites

I have four different arrays and I want to place them into a multi dimensional array and

then I want to place it into a Session variable. This is what I have below.How do I do this?

 

when I print_r($_Session) I don't get anything just option[](2);

 

 


$_SESSION ['option']['green'] = array('name '=>'jeff');
$_SESSION ['option']['red'] = array('name '=>'mary');
$_SESSION ['option']['blue'] = array('name '=>'joe');
$_SESSION ['option']['brown'] = array('name '=>'ash');

 

1. $_Session is not the same as $_SESSION

2. Where are you doing a print_r(), on the same page as these variable assignments or another page?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.