syntax for printing multi-dimensional arrays
| From: | Bob Pillford | Date: | Tue, 23 Mar 2004 10:03:05 +0000 |
| Subject: | syntax for printing multi-dimensional arrays | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-181243@lists.php.net to get a copy of this message | ||
Hi all
I am having problems printing members of an array that has two dimensions and am wondering if someone can help me with the syntax required to do this.
If i have the follwing code:
<?php
$test=array('test1'=>'a','test2'=>'b');
print "$test[test1]";
?>
I get 'a' echoed to the screen as expected. But if i make the array 2 dimensional like this:
<?php
$test[0]=array('test1'=>'a','test2'=>'b');
print "$test[0][test1]";
?>
I would expect to get 'a' echoed to the screen again but instead i get this:
Array[test1].
Has anyone seen this before and can help or point me to some goods docs on it?
Thanks in advance for any help
Cheers
Bob