php通过关联数组循环

问题描述:

在Stackoverflow上编辑此代码,我真的可以得到我需要的结果.

Editing this code here on Stackoverflow and I'm really near to get the result I need.

所以我将这段代码发布在这里:

So I have this code posted down here:

$friends = $facebook->api('/me/friends');
if(!empty($friends['data'])){
$size = variable_get('facebook_graph_pic_size_nodes','square');
$protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
    foreach($friends['data'] as $data){
        $fbid = $data['id'];
        $fbfriendlikes[$fbid]=$facebook->api('/'.$fbid.'/likes'); 
    }

$fbfriendlikes向我输出一个像这样的数组: http://penelope-ns. net/fb/fig.jpg

The $fbfriendlikes outputs me an array like this one : http://penelope-ns.net/fb/fig.jpg

我需要做的是将所有名称保存在$return值中.

What do I need to do is save the names in a $return value, all names.

有人可以帮我吗? 谢谢.

Can someone please help me with this? Thanks.

这应该有效.

$dataArray = $fbfriendlikes[$data['id']]['data'];
$result = "";
foreach($dataArray as $item){
    $result .= " ".$item['name'];
}