Hi,
I have an array like below
$food[0][1] = 'pork';
$food[0][2] = 'chicken';
$food[0][3] = 'ham';
$food[1][1] = '£1';
$food[1][2] = '£2';
$food[1][3] = '£3';
I'd like to use foreach to print the contents into a table like below
| price | type |
| £1 | pork |
| £2 | chicken |
| £3 | ham |
I'm using the following code
foreach($food as $v1) {
foreach ($v1 as $v2) {
echo '<tr>
<td width="32">'. $v1 .'</td>
<td width="443">'. $v2 .'</td>
</tr>';
}
}
and its prints a table like
| price | type |
| Array | pork |
| Array | chicken |
| Array | ham |
| Array | £1 |
| Array | £2 |
| Array | £3 |
Anyone see what I'm doing wrong?
Cheers
Brain