i have an array $arr:
Array
(
[2] => Array
(
[status] => 0
[item] => Food Processer
[catagory] => Appliance
)
[23] => Array
(
[status] => 1
[item] => 12 cup medium muffin tray
[catagory] => Kitchenware
)
[24] => Array
(
[status] => 1
[item] => 24 cup mini muffin tray
[catagory] => Kitchenware
) etc...
i would like to end up with a table row for each element:
<tr id="2" class="0"><td>Food Processer</td><td>Appliance</td></tr>
my current code is:
foreach ($arr as $a)
{
echo('<tr id="'.key($a).'" class="'.$a['status'].'">');
echo('<td>');
echo($a['item']);
echo('</td>');
echo('<td>');
echo($a['catagory']);
echo('</td>');
echo('</tr>');
}
but i am getting the status key (string 'status') as the id value how can i get the parent $arr key ie(2,23,24).