Re: note 12029 added to function.array.php
| From: | Jesus M. Castagnetto | Date: | Mon, 19 Mar 2001 23:38:34 +0000 |
| Subject: | Re: note 12029 added to function.array.php | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-12558@lists.php.net to get a copy of this message | ||
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 headache.
I will add the comment above to your note, if you
rather have your note removed, let me know ASAP.
--- thalis@NOSPAM.cs.pitt.edu wrote:
> 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
>
> http://www.php.net/manual/en/function.array.php
>
>
> --
> PHP Notes Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-notes-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-notes-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
=====
--- Jesus M. Castagnetto <jmcastagnetto@php.net>
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/