php how to duplicate values in array (multidimensional)
<p>My db table is:</p>

<pre><code>author               book                    repeat
------               ----                    ------
Paulo Coelho         the alchemist           2
Adam Smith           The Wealth of Nations   1 
</code></pre>

<p>I fetch data from db with the following php code:</p>

<pre><code>...
$books_array[]= array(
       'author'=&gt; $row['author'],
       'book'=&gt; $row['book'],
);
</code></pre>

<p>But I don't know how to repeat the values according to my repeat value. How can I obtain the following array?</p>

<pre><code> array
     [0] =&gt; Array
        (
          [author] =&gt; Coelho
          [book] =&gt; The Alchemist
        )

     [1] =&gt; Array
        (
          [author] =&gt; Coelho
          [book] =&gt; The Alchemist
        )

     [2] =&gt; Array
        (
          [author] =&gt; Smith
          [book] =&gt; The Wealth of Nations
        )
</code></pre>

<p>Thanks!</p>