PHP foreach loop to populate dropdown list with values from an array of arrays

This solution works for current PHP versions. Simple case of using a foreach:

<select name="per1" id="per1">
  <option selected="selected">Choose one</option>
  <?php
    foreach($names as $name) { ?>
      <option value="<?= $name['name'] ?>"><?= $name['name'] ?></option>
  <?php
    } ?>
</select> 

This solution works for older PHP versions. Simple case of using a foreach:

<select name="per1" id="per1">
  <option selected="selected">Choose one</option>
  <?php
    foreach($names as $name) { ?>
      <option value="<?php echo $name['name'] ?>"><?php echo $name['name'] ?></option>
  <?php
    } ?>
</select> 

i think this is enough

foreach($names as $key =>$value)
{?>
<option value="<?=$value['name']?>"><?=$value['name']?></option>    
<?php }

Tags:

Php

Arrays

Loops