How can dynamic values be assigned to each option in a dropdown list generated using PHP?

To assign dynamic values to each option in a dropdown list generated using PHP, you can create an array with the values you want to assign and then loop through the array to generate the options with the corresponding values.

<select name="dropdown">
<?php
$options = array(
    'Option 1' => 'value1',
    'Option 2' => 'value2',
    'Option 3' => 'value3'
);

foreach ($options as $option => $value) {
    echo "<option value='$value'>$option</option>";
}
?>
</select>