I have a script that select a list of letter from the array but the problem is it only display the last element on the array.
PHP:
<?php
$letters = array("A", "B", "C");
foreach($letters as $letter)
{
$data['#LETTER#'] = $letter;
}
$html = file_get_contents('test.html');
echo $html = str_replace(array_keys($data),array_values($data),$html);
?>
HTML:
<html>
<head>
<title>TRY</title>
</head>
<body>
<select>
<option>#LETTER#</option>
</select>
</body>
</html>
the output above the script is only C which is the last element in the array and I can only select the letter C not A B C
DESIRED OUTPUT:
A
B
C
why is this happen? can anyone help? I appreciate with explanation. I'm currently new on php.