Page 1 of 1

Accessing multidimensional arrays from $_SESSION array

Posted: Mon Jun 03, 2002 8:54 pm
by pointone
If I create a variable like $var[0][0] and assign the string "Hello" to it, then session_register('var'). On the subsequent pages I want to use this variable how do I access it with the $_SESSION[ ???? ] array??

Posted: Mon Jun 03, 2002 10:04 pm
by volka
try this

Code: Select all

<?php
session_start();

if ( !isset($_SESSION&#1111;'var']) )
&#123;
	$var&#1111;0]&#1111;0] = 'test00';
	$var&#1111;1]&#1111;1] = 'test11';
	$_SESSION&#1111;'var'] = $var;
	print('<html><body>values set, refresh now</body></html>');
&#125;
else
&#123;
	print($_SESSION&#1111;'var']&#1111;1]&#1111;1]);
	unset($_SESSION&#1111;'var']);
&#125; ?>

Thank you, Thank you, Thank you!!!

Posted: Mon Jun 03, 2002 10:24 pm
by pointone
All I needed was $_SESSION['blah'][0].
I was doing $_SESSION['blah[0]'] :D