title: unset from array causing internal server error
body: <p>I am trying to merge two arrays by removing duplicate values.
  that is  if  <code>$array_two[$i]-&gt;id == $array_one[$j]-&gt;yelp_id</code> then it is a duplicate.
  so i am trying to remove it.</p>
  
  <p>This is my code..</p>
  
  <pre><code>for($i=0;$i&lt;count($array_two);$i++)
     {
     for($j=0;$j&lt;count($array_one); $j++)
      {
        if($array_two[$i]-&gt;id == $array_one[$j]-&gt;yelp_id)
         {            
  
          //print_r($array_two[$i]);
          unset($array_two[$i]);
  
          }
  
      }
  }
  $array=array_merge($array_one,$array_two);
  </code></pre>
  
  <p>When i do this i am getting an </p>
  
  <blockquote>
    <p>internal server error 500..</p>
  </blockquote>
  
  <p>but when i am printing using <code>print_r</code> i am getting the duplicate entry..</p>
  
  <p>what is wrong in this code?</p>
  
  <p>please help     </p>