How to search array for duplicates using a single array?
<p>I am checking a list of 10 spots, each spot w/ 3 top users to see if a user is in an array before echoing and storing.</p>

<pre><code>foreach($top_10['top_10'] as $top10)        //loop each spot
{
    $getuser = ltrim($top10['url'], " users/" );   //strip url

if ($usercount &lt; 3) {
      if ((array_search($getuser, $array) !== true)) {

            echo $getuser;                              
            $array[$c++] = $getuser;

        }
        else {

            echo "duplicate &lt;br /&gt;&lt;br /&gt;";
        }

     }
    }
</code></pre>

<p>The problem I am having is that for every loop, it creates a multi-dimensional array for some reason which only allows array_search to search the current array and not all combined. I am wanting to store everything in the same $array. This is what I see after a print_r($array)</p>

<pre><code>Array ( [0] =&gt; 120728 [1] =&gt; 205247 ) Array ( [0] =&gt; 232123 [1] =&gt; 091928 )
</code></pre>
