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 speralta on 02/07/07 17:56

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 => $value) {
echo $key.'='.$value;
}


How do I get, in this example, the value of the array element with the
key "vancouver":

Array ( [0] => Array ( [Vancouver] => Vancouver [Eugene] => Eugene
[Beaverton] => Beaverton ) )

 

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

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