php我的foreach循环不要回声

include 'api/apiBase.php';
$farray[] = GetUserFriends($login->User_id);
foreach ($farray as $FID) 
{
    echo "$FID 
";
}

My foreach loop won't echo out the array. the function that i have GetUserFriends Returns 2 variables in a array.

Ok comments dont seem to be working so change your code to this

include 'api/apiBase.php';

// following line changed
$farray = GetUserFriends($login->User_id);

echo $login->User_id . ' has ' . count($farray) . ' friends';

foreach ($farray as $idx => $value) 
{
    echo "Friend $idx has FriendId $value 
";
}

This line $farray[] = GetUserFriends($login->User_id); with the extra [] in is adding another level to the $farray that you dont need and is confusing you.

That's because you're putting the friends array inside another array, like several comments say. – Barmar

Ohh the error was in my function :) Thanks