title: How to keep only specific array keys/values in array?
body: <p>I have a multidimensional array that I am searching trough for specific values. 
  If those values are found I need to extract the indexes with those values ( make new array ) and remove all others. </p>
  
  <p>array_intersect worked fine on php 5.3 , now on 5.4 it complains Notice:  Array to string conversion. </p>
  
  <p>I found that array_intersect has an issue with multidimensional array on 5.4. 
  <a href="https://bugs.php.net/bug.php?id=60198" rel="noreferrer">https://bugs.php.net/bug.php?id=60198</a></p>
  
  <p>This is $options array I am searching trough </p>
  
  <pre><code>Array (
  
      [index1] =&gt; html
      [index2] =&gt; html
      [index3] =&gt; slide
      [index4] =&gt; tab
      [index5] =&gt; Array
          (
              [0] =&gt; 123
          )
  
  )
  </code></pre>
  
  <p>code that works on php 5.3.x</p>
  
  <pre><code>$lookfor   = array('slide', 'tab');
  $found     = array_intersect($options, $lookfor);
  
  
  print_r($found);
  
  
  Array
  (
      [index3] =&gt; slide
      [index4] =&gt; tab
  )
  </code></pre>
  
  <p>but in 5.4.x  this trows the error mentioned above. </p>
  
  <p><strong>What would be another way to do this without a loop please.
  and without suppressing the error.</strong> </p>
  
  <p>Thank you!</p>