title: Need key index to 0 based on subcat element value in array
body: <pre><code>Array
      (
          [product_id] =&gt; 79
          [sub_category] =&gt; 63
      )
      Array
      (
          [product_id] =&gt; 89
          [sub_category] =&gt; 63
      )
      Array
      (
          [product_id] =&gt; 9
          [sub_category] =&gt; 6
      )
      Array
      (
          [product_id] =&gt; 90
          [sub_category] =&gt; 6
      ) 
  </code></pre>
  
  <p>I have an array named $row and I am getting these results.I am using codeignitor.Please help me to resolve it out.I need array key baed on subcategory values.I have mentioned below both array what I am getting and what I need .Please help me to resolve it asap.I need it should give key as based on subcategory.I mainy need subcategory id and then all its products id.All result I get in one array named row</p>
  
  <pre><code>Array
  (
     [0]=&gt; [product_id] =&gt; 79
      [sub_category] =&gt; 63
  [1]=&gt;
      [product_id] =&gt; 89
      [sub_category] =&gt; 63
  )
  Array
  (
    [0]=&gt;  [product_id] =&gt; 9
      [sub_category] =&gt; 6
  [1]=&gt;
      [product_id] =&gt; 90
      [sub_category] =&gt; 6
  )
  </code></pre>