Dynamic Multi Dimensional Arrays

From: Date: Tue, 09 Sep 2003 16:41:09 +0000
Subject: Dynamic Multi Dimensional Arrays
Groups: php.general 
Request: Send a blank email to php-general+get-162090@lists.php.net to get a copy of this message
Hello Everyone, I want to emulate session objects (as opposed to variables). I stumbled upon creating multi-dimensional arrays, so I can do this: $name = 'Bob'; $year = '2003'; $HTTP_SESSION_VARS[$user][$year] = 'registered'; which gives $HTTP_SESSION_VARS['Bob']['2003'] = 'registered'; but I want to append an options array in this so what I want is: $options = array ( 'income' => 10000, 'age' => 25 ); (Where the $options array is created dynamically from passed POST data). $HTTP_SESSION_VARS[$user][$options] = 'registered'; which gives: $HTTP_SESSION_VARS['Bob'][ [income]=10000, [age]=25 ] = 'registered'; but this doesn't work. Is there any way I can have "objects" saved in sessions? Bobby

« previous php.general (#162090) next »