Hi,

Tuesday, March 23, 2004, 8:03:05 PM, you wrote:
BP> Hi all

BP> I am having problems printing members of an array that has two 
BP> dimensions and am wondering if someone can help me with the syntax
BP> required to do this.

BP> If i have the follwing code:
BP> <?php
BP> $test=array('test1'=>'a','test2'=>'b');
BP> print "$test[test1]";
?>>

BP> I get 'a' echoed to the screen as expected. But if i make the array 2
BP> dimensional like this:

BP> <?php
BP> $test[0]=array('test1'=>'a','test2'=>'b');
BP> print "$test[0][test1]";
?>>

BP> I would expect to get 'a' echoed to the screen again but instead i get this:
BP> Array[test1].

BP> Has anyone seen this before and can help or point me to some goods docs
BP> on it?

BP> Thanks in advance for any help

BP> Cheers

BP> Bob


You don't need the outside quotes just

print $test[0]['test1']

( Note test1 needs the quotes )

If you need to output other stuff then use the . operator like

print 'Value = '.$test[0]['test1'].'<br>';

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to