使用php从数组中获取值

I have made a login system through facebook, after signin, i am trying to fetch number of friends. For this i have used

$friends = $facebook->api('/me/friends');

echo '<pre>';
    print_r($friends);
echo '</pre>';

when i use it i get values in an array, but i am notable to fetch values from an array

Array
(
    [data] => Array
        (
        )

    [summary] => Array
        (
            [total_count] => 1
        )

)

i wish to get the value of [total_count] inside $totalfriends

Would appreciate if someone could help me

To get total count try

$totalfriends = $friends['summary']['total_count'];

That would be something like:

$friends['summary']['total_count']

$friends = $friends['summary']['total_count'];