Это неправильно. Он проверяет наличие дубликатов, но только содержимое каждого цикла foreach, а не весь массив. Как это будет, если я сохраняю все в $array?
Я хочу добавить каждого пользователя в массив и перед этим проверить наличие дубликатов. [code]$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!