3
I have the following matrix in PHP:
$matriz['HGF']['Christus'] = 7;
$matriz['HGF']['Unifor'] = 6;
$matriz['HIAS']['Christus'] = 5;
$matriz['HIAS']['Unifor'] = 4;
I would like to print the matrix in html, displaying indexes and values, like this:
<table>
<tbody>
<tr>
<td> </td>
<td> Christus </td>
<td> Unifor </td>
</tr>
<tr>
<td> HGF </td>
<td align="center"> 7 </td>
<td align="center"> 6 </td>
</tr>
<tr>
<td> HIAS </td>
<td align="center"> 5 </td>
<td align="center"> 4 </td>
</tr>
</tbody>
</table>
I was able to do this in a one-dimensional array using the foreach, but I’m not getting it in this matrix.
But you want the entire table to be dynamic, done by PHP or just where the result is ?
– Vinicius Shiguemori
The table is dynamic, formed by data taken from the database (including indexes are dynamic).
– Camila Colares