Код: Выделить всё
$spotcount = 10;
for ($topuser_count = 0; $topuser_count < $spotcount; $topuser_count++) //total spots
{
$spottop10 = $ids[$topuser_count];
$top_10 = $gowalla->getSpotInfo($spottop10);
$usercount = 0;
$c = 0;
$array = array();
foreach($top_10['top_10'] as $top10) //loop each spot
{
//$getuser = substr($top10['url'],7); //strip the url
$getuser = ltrim($top10['url'], " users/" );
if ($usercount < 3) //loop only certain number of top users
{
if (($getuser != $userurl) && (array_search($getuser, $array) !== true))
{
//echo " no duplicates!
";
echo ' [url= ]
[img] [/img]
[/url] ';
$array[$c++] = $getuser;
}
else {
//echo "duplicate
";
}
}
$usercount++;
}
print_r($array);
}
Код: Выделить всё
Array ( [0] => 62151 [1] => 204501 [2] => 209368 )
Array ( [0] => 62151 [1] => 33116 [2] => 122485 )
Array ( [0] => 120728 [1] => 205247 [2] => 33116 )
Array ( [0] => 150883 [1] => 248551 [2] => 248558 )
Array ( [0] => 157580 [1] => 77490 [2] => 52046 )
Подробнее здесь: https://stackoverflow.com/questions/274 ... -in-a-loop