You are here: Re: getting values in an array of arrays « PHP Programming Language « IT news, forums, messages
Re: getting values in an array of arrays

Posted by Rik on 02/07/07 18:17

<speralta@progressivetrail.org> wrote:

> On Feb 7, 9:35 am, Michael Fesser <neti...@gmx.de> wrote:
>> .oO(spera...@progressivetrail.org)
>>
>> >The following is the output of a print_r on an array. The value of
>> >element[0] is itself an array. How do I access the elements in the
>> >second array?
>>
>> $foo[1st level][2nd level][3rd level]
>>
>> Micha
>
> Hi Micha,
>
> Thanks for the suggestion, It was the step in the right direction that=

> I needed to resolve the problem. The problem was that I was trying to=

> access the elements in the associative array by index numbers rather
> than as a key/value pair. This worked:
>
> foreach($city[0] as $key =3D> $value) {
> echo $key.'=3D'.$value;
> }
>
>
> How do I get, in this example, the value of the array element with the=

> key "vancouver":
>
> Array ( [0] =3D> Array ( [Vancouver] =3D> Vancouver [Eugene] =3D> Euge=
ne
> [Beaverton] =3D> Beaverton ) )


$city[0]['Vancouver']

If you perhaps do not know the key names in advance you'll have to give =
us =

a little more insight in the actual purpose.
-- =

Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация