How to echo every values in multi dimensional array using php? -
how can done?
i want echo each values in multidimensional array.
here print_r of array.
array ( [7] => array ( [sale] => 08 [not_sale] => 00 [inventory] => -- [not_inventory] => -- ) [1] => array ( [inventory] => 17 [not_inventory] => 00 [sale] => 08 [not_sale] => 00 ) [2] => array ( [inventory] => 17 [not_inventory] => 00 [sale] => 08 [not_sale] => 00 ) [3] => array ( [inventory] => 17 [not_inventory] => 00 [sale] => 08 [not_sale] => 00 ) [4] => array ( [inventory] => 17 [not_inventory] => 00 [sale] => 08 [not_sale] => 00 ) [5] => array ( [inventory] => 17 [not_inventory] => 00 [sale] => -- [not_sale] => -- ) [6] => array ( [inventory] => -- [not_inventory] => -- [sale] => -- [not_sale] => -- ) )
i want echo each item in each array...
here code. no luck! please respect
for($row=0; $row<7; $row++) { for($col=0; $col<7; $col++) { echo $myarray[$row][$col] . "<br/>"; } }
use foreach
foreach($myarray $subarray) { foreach($subarray $key => $val) { echo $key . " - " . $val . "<br/>"; } }
Comments
Post a Comment