 <p>If I understood correctly the purpose is to create an array with 10 "Apples" and another one with 5 "Balls"</p> <pre><code>$array = array ( array ("Apple", 10), array("Ball", 5) ); $newarray = array(); foreach($array as $key =&gt; $val){ $tmparray = null; for($i = 1; $i &lt;= $val[1]; $i++){ $tmparray[$i] = $val[0]; } $newarray[] = $tmparray; } print_r($newarray); </code></pre> <p>output:</p> <pre><code>Array ( [0] =&gt; Array ( [1] =&gt; Apple [2] =&gt; Apple [3] =&gt; Apple [4] =&gt; Apple [5] =&gt; Apple [6] =&gt; Apple [7] =&gt; Apple [8] =&gt; Apple [9] =&gt; Apple [10] =&gt; Apple ) [1] =&gt; Array ( [1] =&gt; Ball [2] =&gt; Ball [3] =&gt; Ball [4] =&gt; Ball [5] =&gt; Ball ) ) </code></pre>