tarun Posted March 24, 2007 Share Posted March 24, 2007 This Is A Quick Multi Dimensional Array That Ive Put Together <?php $itemList = array( '000001'=>array('ID' => '000001','name' => 'Item 1','price' => '99.99','img' => 'images/1.jpg','cat' => 'Category 1'), '000002'=>array('ID' => '000002','name' => 'Item 2','price' => '49.99','img' => 'images/2.jpg','cat' => 'Category 2') ); ?> How Do I List The Items Info Using foreach Thnx, Tarun Quote Link to comment Share on other sites More sharing options...
fert Posted March 24, 2007 Share Posted March 24, 2007 foreach($itemList as $key=>$value) { foreach($value as $k=>$v) { /*do stuff here*/ } } Quote Link to comment Share on other sites More sharing options...
Barand Posted March 24, 2007 Share Posted March 24, 2007 As your array key is the ID you don't need to repeat it in the array values. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.