accessing array contents
| From: | John Hughes | Date: | Sat, 24 Aug 2002 04:28:12 +0000 |
| Subject: | accessing array contents | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-113896@lists.php.net to get a copy of this message | ||
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