How To Modify This Array Into Associative Array?
<p>I have this code :</p>

<pre><code>$genders = array('Male', 'Female');

foreach ( $genders as $gender ) {
echo '&lt;option' . ( $rowMyBiodata['Gender'] == $gender ? ' selected' : '' ) . '&gt;';
echo $gender;
echo '&lt;/option&gt;';
}
</code></pre>

<p>and that code produce HTML code like this :</p>

<pre><code>&lt;option selected&gt;Male&lt;/option&gt;
&lt;option&gt;Female&lt;/option&gt;
</code></pre>

<p>now, I want to add a value on each option so that output will be like this :</p>

<pre><code>&lt;option selected value='M'&gt;Male&lt;/option&gt;
&lt;option value='F'&gt;Female&lt;/option&gt;
</code></pre>

<p>I think by changing the array into associative array can solve this problem :</p>

<pre><code>$genders = array('M'=&gt;'Male', 'F'=&gt;'Female');
</code></pre>

<p>but how to get array's index so it can be used as value on the option tag?</p>
