title: Search in 2 arrays
body: <p>I have problem with search in arrays , in 2 arrays , the first array have one structure fixed and the second send the vars from url and can have some values empty , for example </p>
  
  <p><strong>FIRST ARRAY :</strong></p>
  
  <p><strong>The structure it's this :</strong></p>
  
  <p>id value , cat value , subcat value and country value </p>
  
  <pre><code>$ar_val="134567,dogs,food,EEUU";
  </code></pre>
  
  <p><strong>The second var get from URL</strong> </p>
  
  <pre><code>$ar_url="134567,dogs,toys,EEUU";
  </code></pre>
  
  <p>As you can see in the second var , $ar_url i have one value no same to the first structure of $ar_val <strong>in this case toys</strong></p>
  
  <p>I want get compare the fixed structure of $ar_val and get if true or false if have same value in the same order from $ar_val</p>
  
  <p>I try this :</p>
  
  <pre><code>$ar_val="134567,dogs,food,EEUU";
  $ar_url="134567,dogs,toys,EEUU";
  
  
  $exp_ar_val=explode(",",$ar_val);
  $exp_ar_url=explode(",",$ar_url);
  
  
  foreach ($exp_ar_val as $exp_ar_val2)
  {
  $ar_val_end[]=$exp_ar_val2;
  }
  
  foreach ($exp_ar_url as $exp_ar_url2)
  {
  $ar_val_end2[]=$exp_ar_url2;
  }
  
  
  
  $end_results=array_intersect($ar_val_end,$ar_val_end2);
  </code></pre>
  
  <p>With this I want know for example: If I search by id and for example for cat , get result positive in 2 arrays i have the same data , but if search for subcat i can´t get results because are differents in one have food and in other have toys , but with array_intersect no get this for compare </p>
  
  <p>Thank´s , Regards </p>