$ext is an array
$noofformats = count($data['formats']);
for($x = 0; $x < $noofformats; $x++){
echo $select = "<option value=\"" . $x . "\">" . $ext[$x] . "</option>";
}
When I run this script I get the desired result. Result 1:
<option value="0">webm</option><option value="1">m4a</option> and so on.....
This works because it echos the result everytime it runs, so I get the string with every value of $noofformat possible. But I wish to define $select as the result shown above. What happens is everytime function loops the newer result is defined instead of being added to the previous value, resulting in only the last value
<option value="33">mp4</option>
I wish
echo $select;
to give a result like Result 1