How can the same variable be used multiple times in dropdowns in PHP?

When using the same variable multiple times in dropdowns in PHP, you can create an array with the values you want to display in the dropdowns and then iterate over the array to generate each dropdown. This way, you can reuse the same variable for multiple dropdowns without conflict.

<?php
// Define an array with values for dropdowns
$options = array("Option 1", "Option 2", "Option 3");

// Generate multiple dropdowns using the same variable
for ($i = 1; $i <= 3; $i++) {
    echo "<select name='dropdown_$i'>";
    foreach ($options as $option) {
        echo "<option value='$option'>$option</option>";
    }
    echo "</select><br>";
}
?>