PHP Générer un tableau multidimensionnel avec index et valeur et imprimer dans la table


Exemple

Array 
( 
    [0] => Array 
        ( 
            [id] => 13 
            [category_id] => 7 
            [name] => Leaving Of Liverpool 
            [description] => Leaving Of Liverpool 
            [price] => 1.00 
            [virtual] => 1 
            [active] => 1 
            [sort_order] => 13 
            [created] => 2007-06-24 14:08:03 
            [modified] => 2007-06-24 14:08:03 
            [image] => NONE 
        ) 

    [1] => Array 
        ( 
            [id] => 16 
            [category_id] => 7 
            [name] => Yellow Submarine 
            [description] => Yellow Submarine 
            [price] => 1.00 
            [virtual] => 1 
            [active] => 1 
            [sort_order] => 16 
            [created] => 2007-06-24 14:10:02 
            [modified] => 2007-06-24 14:10:02 
            [image] => NONE 
        ) 

)  

Tableau multidimensionnel en sortie avec index et valeur dans le tableau

<table>
<?php 
foreach ($products as $key => $value) {
    foreach ($value as $k => $v) {
        echo "<tr>";
        echo "<td>$k</td>"; // Get index.
        echo "<td>$v</td>"; // Get value.
        echo "</tr>";
    }
}
?>
</table>