array combine by array key in php?
<p><strong>is there a good function that can combine array by key ? ( in this example is pid )</strong></p>

<pre><code>array
  0 =&gt; 
    array
      'product' =&gt; string 'a product pid 3' (length=9)
      'name' =&gt; string 'adamramadhan' (length=12)
      'pid' =&gt; string '3' (length=1)
      'timecreate' =&gt; string '2011-02-26 13:30:07' (length=19)
  1 =&gt; 
    array
      'product' =&gt; string 'a product pid 4' (length=8)
      'name' =&gt; string 'adamramadhan' (length=12)
      'pid' =&gt; string '4' (length=1)
      'timecreate' =&gt; string '2011-02-26 13:30:54' (length=19)
</code></pre>

<p>and</p>

<pre><code>array
  0 =&gt; 
    array
      'pid' =&gt; string '3' (length=1)
      'comment' =&gt; string 'a comment on pid 3' (length=8)
  1 =&gt; 
    array
      'pid' =&gt; string '4' (length=1)
      'comment' =&gt; string 'a comment on pid 4' (length=8)
  2 =&gt; 
    array
      'pid' =&gt; string '3' (length=1)
      'comment' =&gt; string 'a comment on pid 3' (length=5)
  3 =&gt; 
    array
      'pid' =&gt; string '4' (length=1)
      'comment' =&gt; string 'a comment on pid 4' (length=5)
  4 =&gt; 
    array
      'pid' =&gt; string '3' (length=1)
      'comment' =&gt; string 'a comment on pid 3' (length=7)
  5 =&gt; 
    array
      'pid' =&gt; string '4' (length=1)
      'comment' =&gt; string 'a comment on pid 4' (length=7)
  6 =&gt; 
    array
      'pid' =&gt; string '3' (length=1)
      'comment' =&gt; string 'a comment on pid 3' (length=18)
  7 =&gt; 
    array
      'pid' =&gt; string '4' (length=1)
      'comment' =&gt; string 'a comment on pid 4' (length=18)
</code></pre>

<p>to something like</p>

<pre><code>array
  0 =&gt; 
    array
      'product' =&gt; string 'a product pid 3' (length=9)
      'name' =&gt; string 'adamramadhan' (length=12)
      'pid' =&gt; string '3' (length=1)
      'timecreate' =&gt; string '2011-02-26 13:30:07' (length=19)
      'comments' =&gt; array 
        0 =&gt; 
          array
            'pid' =&gt; string '3' (length=1)
            'comment' =&gt; string 'a comment on pid 3' (length=8)
        2 =&gt; 
          array
            'pid' =&gt; string '3' (length=1)
            'comment' =&gt; string 'a comment on pid 3' (length=5)
        4 =&gt; 
          array
            'pid' =&gt; string '3' (length=1)
            'comment' =&gt; string 'a comment on pid 3' (length=7)
        6 =&gt; 
          array
            'pid' =&gt; string '3' (length=1)
            'comment' =&gt; string 'a comment on pid 3' (length=18)
  1 =&gt; 
    array
      'product' =&gt; string 'a product pid 4' (length=8)
      'name' =&gt; string 'adamramadhan' (length=12)
      'pid' =&gt; string '4' (length=1)
      'timecreate' =&gt; string '2011-02-26 13:30:54' (length=19)
      'comments' =&gt; array 
        1 =&gt; 
          array
            'pid' =&gt; string '4' (length=1)
            'comment' =&gt; string 'a comment on pid 4' (length=8)
        3 =&gt; 
          array
            'pid' =&gt; string '4' (length=1)
            'comment' =&gt; string 'a comment on pid 4' (length=5)
        5 =&gt; 
          array
            'pid' =&gt; string '4' (length=1)
            'comment' =&gt; string 'a comment on pid 4' (length=7)
        7 =&gt; 
          array
            'pid' =&gt; string '4' (length=1)
            'comment' =&gt; string 'a comment on pid 4' (length=18)
</code></pre>

<p>or with no pid on each product comments array ( nested on products array ) ?</p>

<p>thanks for looking in.</p>

<p>Adam Ramadhan</p>
