title: PHP filter 2 dimensional array by specific key
body: <p>I have this array:</p>
  
  <pre><code>Array
  (
      [702a4584] =&gt; Array
          (
              [type] =&gt; folder
              [id] =&gt; 702a4584
          )
  
      [b547b3a9] =&gt; Array
          (
              [type] =&gt; folder
              [id] =&gt; b547b3a9
  
          )
  
      [fcb0d055] =&gt; Array
          (
              [type] =&gt; page
              [id] =&gt; fcb0d055
          )
  )
  </code></pre>
  
  <p>I want to filter the array such that only type "folder" will remain:</p>
  
  <pre><code>Array
  (
      [702a4584] =&gt; Array
          (
              [type] =&gt; folder
              [id] =&gt; 702a4584
          )
  
      [b547b3a9] =&gt; Array
          (
              [type] =&gt; folder
              [id] =&gt; b547b3a9
  
          )
  
  )
  </code></pre>
  
  <p>I could do this, but I'll be needing a generic function:</p>
  
  <pre><code>$temp = array();
  foreach($array as $key =&gt; $value)
  {
      if($value['type'] =="folder")
      {
          $temp[$key] = $value; 
      }
  }
  </code></pre>