Asign value to array in for loop
<p>I know init php array method is </p>

<pre><code>$a=array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
</code></pre>

<p>but i must assign in two dim array, such data is </p>

<pre><code> [0]=&gt; array(6) { ["id"]=&gt; string(1) "2" ["menu_name"]=&gt; string(12) "小吃菜單" ["button_pic_save_path"]=&gt; string(40) "/images/left_button/menu/normal_menu.gif" ["cover_button_pic_save_path"]=&gt; string(46) "/images/left_button/menu/normal_menu_cover.gif" ["order_number"]=&gt; string(1) "0" ["modify_time"]=&gt; string(19) "2013-04-07 09:37:43" } } 
 [1]=&gt; array(6) { ["id"]=&gt; string(1) "3" ["menu_name"]=&gt; string(12) "小吃菜單" ["button_pic_save_path"]=&gt; string(40) "/images/left_button/menu/normal_menu.gif" ["cover_button_pic_save_path"]=&gt; string(46) "/images/left_button/menu/normal_menu_cover.gif" ["order_number"]=&gt; string(1) "0" ["modify_time"]=&gt; string(19) "2013-04-07 09:37:43" } } 
</code></pre>

<p>now my Implement code as follow..</p>

<pre><code>$query_menu_data = select_sql(QUERY_MENU_SQL_STR);

if(count($query_menu_data) &gt;= 1)
{
    $ary_menu[count($query_menu_data)];

    for($loop_i = 0; $loop_i &lt; count($query_menu_data); $loop_i++)
    {
        for($loop_j = 0; $loop_j &lt; count($ARY_MENU_FIELD); $loop_j++)
        {
            // hash key
            /*
            $ary_menu[$loop_i] = array( 
                $ARY_MENU_FIELD[$loop_j] =&gt;  $query_menu_data[$loop_i][$loop_j]
            );
            */
            $ary_menu[$loop_i] = array( 
                $ARY_MENU_FIELD[$loop_j] =&gt;  $query_menu_data[$loop_i][$loop_j]
            );
        }   // end loop j
    } // end loop i
}
</code></pre>

<p>the result of array always save the last data, what method can I solve it.</p>

<p>Thank to every body, the solve method is in comment.</p>
