I have an array like the following:
开发者_JAVA技巧Array (
[feed] => Array (
[0] => Array (
[title] => Stackoverflow
[permalink] => http://www.stackoverflow.com
)
[1] => Array (
[title] => Yahoo
[permalink] => http://www.yahoo.com
)
)
)
How can I get the title? I tried this:
$data['feed']['title']
Shouldn't it be this:
$data['feed'][0]['title']
You should use
foreach($data['feed'] as $val) {
echo $val['title']
}
to get all titles
You are missing the numeric index:
Array (
[feed] => Array (
[0] => Array (
[title] => Stackoverflow[permalink] => http://www.stackoverflow.com)
[1] => Array (
[title] => Yahoo [permalink] => http://www.yahoo.com) )
)
)
$data['feed'][0]['title']
精彩评论