I'm having a multidimensional array from which I don't know the keys and I need all key's with their value.
My array is database filled:
$rows[$product_id][$productgroup_id] = $amount
So the array is for example filled with 2 products:
$rows[108][3] = 2
$rows[2][5] = 4
So my array now holds 2 product:
- Product_id 108 from productgroup 3 with an amount of 2
- Product_id 2 from productgroup 5 with an amount of 4
Now I need to walk through the array and I need the keys and the amount. So I'm thinking in a foreach loop
foreach($rows as $row){
foreach($row as $key => $value){
echo "Key:".$key." Value: ".$value."<br>";"
}
}
But this only echo's the first key, product_id and the amount. But I need the product_id, productgroup_id and the amount. So how do I also get the productgroup_id?