I'm creating some select drop downs dynamically with PHP.
<select name="player_id" style="width:140px;">
<?php usort($players, 'compareName'); ?>
<?php foreach ($players as $player) { ?>
<option value="<?php echo $player['id']; ?>"><?php echo $player['first_name'] . " " . $player['last_name']; ?></option>
<?php } ?>
</select>
The $players array currently has about 1600 records. The select drop down is created about 20 times, meaning it loops through the 1600 records 20 times.
My question is about load times.. is there a way I can create the same select once and then output it over and over again to improve load time rather than having it loop each time? Or would this be considered best practice?