title: Is there a better way to filter an associative array?
body: <p>Trying to sort my array to show the group with meat categoryName to be first element in array. Is there a better way to sort this array than running two for loops?
  My array looks like this</p>
  <pre><code>Array
  (
      [0] =&gt; Array
          (
  
              [categoryId] =&gt; C4ye95zr403cx9wqi11eo
              [categoryName] =&gt; set
              [categoryStatus] =&gt; true
          )
  
      [1] =&gt; Array
          (
  
              [categoryId] =&gt; Cj-v2b7szu3jpph1rvu03
              [categoryName] =&gt; meat
              [categoryStatus] =&gt; true
          )
  
  </code></pre>
  <p>I want to rearrange the array by categoryName == meat to be first element in array.</p>
  <p>Currently i'm just running two loops to do this.</p>
  <pre><code>$temp = array();
  foreach($array as $k =&gt; $v)
              {
                  if($v['categoryName']==&quot;meat&quot;)
                  {
                      $temp[]     = $menu[$k];
                      $setEmpty   = false;
                      unset($array[$k]);
                  }
              }
              foreach($menu as $k=&gt;$v)
              {
                  $temp[] = $array[$k];
              }
  </code></pre>