I have used array_combine to print out 2 different arrays, but the function use first array for index, and he supress values with same content. I need printout even when has a same value. Some tip about how resolve this?
function mostra_2com($valor, $valor2){
echo "<table class='bs'><tr><td><b>Atividades</b></td><td><b>Opiniões</b></td></tr>";
foreach (array_combine($valor, $valor2) as $val => $val2)
echo "<tr><td>".$val." </td><td> ".$val2."<br></td></tr>";
echo"</table>";
}
enter code here
You probably want to use
MultipleIterator
:It iterates over both arrays at the same time and for each iteration yields
$values
as an array like this:In this example
1
and4
would come from$valor
and$valor2
respectively. I then useextract()
inside the loop to bind those keys to actual variables.