title: How to change array format from one multidimensional form to another?
body: <p>I have a multidimensional array in the below format. What I try to do I am getting either undefined offset error or repeated array cells.</p>
  
  <pre><code>arr[] = Array
              (
              [0] =&gt; Array
                      (
                     [grp1] = A
                     [grp2]=Array(
                          [0] =&gt; a
                          [1] =&gt; b
                          [2] =&gt; c
  
                      )
                )
             [1] =&gt; Array
                      (
                     [grp1] = B
                     [grp2]=Array(
                          [0] =&gt; d
                          [1] =&gt; e
  
                      )
                    )
                )
  </code></pre>
  
  <p>I want to convert the above array to the following format.</p>
  
  <pre><code>arr[] = Array
              (
              [0] =&gt; Array
                      (
                     [grp1] = A
                     [grp2]=a
  
                      )
  
             [1] =&gt; Array
                      (
                     [grp1] = A
                     [grp2]=b
  
                      )
  
               [2] =&gt; Array
                      (
                     [grp1] = A
                     [grp2]=c
  
                      )
  
             [3] =&gt; Array
                      (
                     [grp1] = B
                     [grp2]=d
  
                      )
            [4] =&gt; Array
                      (
                     [grp1] = B
                     [grp2]=e
  
                      )
             )
  </code></pre>
  
  <p><em>First of all sorry that my question is not explained well. Actually I dont know what to ask in this case. Any edits will be appreciated.</em></p>