note 12029 deleted from function.array by irc-html
| From: | irc-html@php.net | Date: | Sat, 19 Jan 2002 20:53:58 +0000 |
| Subject: | note 12029 deleted from function.array by irc-html | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-25431@lists.php.net to get a copy of this message | ||
[Editor's note: Looks like you missed the manual section: "String Operators" in
Chapter 10, and more importantly the section "Arrays" in Chapter 6
Reading the manual can save you a lot of time and headache.]
It took me a while to figure this out. I was trying to access elements of a multidimensional array
whose elements where associative arrays
e.g. $heroes=array(
array( name=>"sally",age=>12),
array( name=>"donald",age=>5)
);
If you try to access for example element heroes[0][name] which is "sally", as:
print "I love superhero: $heroes[0][name]";
what you will actually get is:
I love superhero Array[name]
What you should do is concatenate the variable with the text and not include it in the double quotes
hoping that php will interpret it like it does with simple scalars:
<?php
print "I love superhero: ".$heroes[0][name] ;
?>
regards,
thalis