DO customize PHP Array?
<pre><code>$original  = Array(
0=&gt;"03A ",//first "03", substr("04w",0,2)=="03"
1=&gt;"04a ",//first "04" of first "03"
2=&gt;"05b ",
3=&gt;"06c ",
4=&gt;"07d ",

6=&gt;"04w ",//second "04" of first "03"
7=&gt;"05x ",
8=&gt;"06y ",
9=&gt;"07z ",

10=&gt;"03B    ",//second "03"
11=&gt;"04l    ",//first "04" of second "03" //substr("04w",0,2)=="03"
12=&gt;"05m    ",
13=&gt;"06n    ",
14=&gt;"07o    ",

15=&gt;"04l    ",//second "04" of second "03" //substr("04l",0,2)=="03"
16=&gt;"05m    ",
17=&gt;"06n    ",
18=&gt;"07o    "
);

echo '&lt;pre&gt;';
print_r($original);
echo '&lt;/pre&gt;';

function customize_array($original){
  $customized_array = array();
  foreach($original as $value) {
      if(substr($value,0,2) == "03") {
      // CHANGE 1
      $save = $value;// saved "03" yo put in child too.
      ++$r;//inc parent
      $j = 0; // child 
      $customized_array[$r][$j] =$value; // create parent
      } else {
      if (($j % 4) &gt; 0) $value .= $value;
      // CHANGE 2
      else if ($j &amp;&amp; $j % 4 == 0) $value = $save.$value;
      $customized_array[$r][floor($j / 4)] .= $value;
      ++$j;//inc child
      }
  }
  return $customized_array;
}

$display_list = customize_array($original);
echo '&lt;pre&gt;';
print_r($display_list);
echo '&lt;/pre&gt;';
</code></pre>

<p>OUTPUT:</p>

<pre><code>/*

Array
(
    [1] =&gt; Array
        (
            [0] =&gt; 03A  04a 05b 05b 06c 06c 07d 07d 
            [1] =&gt; 03A  04w 05x 05x 06y 06y 07z 07z 
        )

    [2] =&gt; Array
        (
            [0] =&gt; 03B  04l 05m 05m 06n 06n 07o 07o 
            [1] =&gt; 03B  04l 05m 05m 06n 06n 07o 07o 
        )

)
</code></pre>

<p>*/</p>

<p>Everybody here have any idea with the function to get the this result.</p>

<pre><code>/*

   Array
(
    [1] =&gt; Array
        (
            [0] =&gt; 03A  04a 05b 06c 07d 
            [1] =&gt; 03A  04w 05x 06y 07z 
        )

    [2] =&gt; Array
        (
            [0] =&gt; 03B  04l 05m 06n 07o 
            [1] =&gt; 03B  04l 05m 06n     07o 
        )

)


*/
</code></pre>
