What is the correct syntax for displaying each value of an array as a separate option in HTML using PHP?
When displaying each value of an array as a separate option in HTML using PHP, you can use a foreach loop to iterate through the array and generate an option tag for each value. This allows you to dynamically create options based on the values in the array.
<select>
<?php
$array = ['Option 1', 'Option 2', 'Option 3'];
foreach ($array as $value) {
echo "<option value='$value'>$value</option>";
}
?>
</select>