Re: accessing array contents
| From: | Justin Garrett | Date: | Sat, 24 Aug 2002 06:30:20 +0000 |
| Subject: | Re: accessing array contents | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-113898@lists.php.net to get a copy of this message | ||
$match_list[$i]['imageurl']
Justin Garrett
"John Hughes" <john@jomari.com> wrote in message
news:001101c24b26$a94f9280$2101a8c0@pbi.net...
> I'm having trouble figuring out how to access specific fields in an
> associative array.
>
> I have an array called match_list with elements of imagename, album and
> imgurl.
>
> $match_list[$i]['imagename']=$this_match[$file_match];
> $match_list[$i]['album']=$this_match[$album_match];
> $match_list[$i]['imageurl']= $this_match[$album_match] . "/" .
> $this_match[$file_match];
>
> I can read the contents sequentially with this coding:
>
> foreach ($match_list as $key => $value)
> {
> foreach ($value as $tkey => $tvalue)
> {
> echo "$tkey = $tvalue<br>";
> }
> }
>
> Therefore, I know I've got values stored.
>
> How do I access just the "imgurl" for each match_list[$i] element?
>
> What I want to do is take the first nine match_list[$i] values and display
> just the imgurl
>
> for ($i = 1; $i <= 10; $i++)
> {
> print ??? what?
> }
>
> Thanks for the help.
>
> John Hughes
>