title: How to search by key=>value in a multidimensional array in PHP
body: <p>Is there any fast way to get all subarrays where a key value pair was found in a multidimensional array? I can't say how deep the array will be.</p>
  
  <p>Simple example array:</p>
  
  <pre><code>$arr = array(0 =&gt; array(id=&gt;1,name=&gt;"cat 1"),
               1 =&gt; array(id=&gt;2,name=&gt;"cat 2"),
               2 =&gt; array(id=&gt;3,name=&gt;"cat 1")
  );
  </code></pre>
  
  <p>When I search for key=name and value="cat 1" the function should return:</p>
  
  <pre><code>array(0 =&gt; array(id=&gt;1,name=&gt;"cat 1"),
        1 =&gt; array(id=&gt;3,name=&gt;"cat 1")
  );
  </code></pre>
  
  <p>I guess the function has to be recursive to get down to the deepest level.</p>