I have two arrays
in php
, which I compare and create a third and want to print this difference in a list.
I've tried foreach
, but this method prints a huge list in string
.
This is my code:
$sql = mysqli_query($cx, "SELECT IPS FROM ipvalidos ORDER BY IPS ASC ");
while($aux = mysqli_fetch_assoc($sql)) {
$arrayip[ ] = $aux["IPS"];
}
$diferenca = array_diff($arrayip, $arraycompara);
foreach ($diferenca as $diferencas)
{
$stringArrayF = $stringArrayF.$diferencas;
}
echo $stringArrayF;
The printed output exits:
192.168.0.1192.168.0.2192.168.0.3192.168.0.4192.168.0.5...
I would like to be able to put this result into a select html
<select><option value="$stringArrayF">$stringArrayF</option>;