Jsuperman2 Posted March 16, 2017 Share Posted March 16, 2017 I have three products in an array like this: Array ( [0] =>Array ( [text] => word [value] => word [isSelected] => [price] => ) [1] => Array ( [text] => word2 [value] => word2 [isSelected] => [price] => ) [2] => Array ( [text] => word3 [value] => word3 [isSelected] => [price] => ) ) I would like to have a listing like this: word word2 word3 Please help! Quote Link to comment https://forums.phpfreaks.com/topic/303463-multidimensional-array-print-sertain-values/ Share on other sites More sharing options...
ginerjm Posted March 16, 2017 Share Posted March 16, 2017 A pretty complex structure. Can one even do this? Arrays usually have a series of pairs (key>value) not pairs pointing to more pairs. Of course I could be mis-reading this but it is confusing to look at. Is this Really your structure or just something you wrote here and don't really have? Quote Link to comment https://forums.phpfreaks.com/topic/303463-multidimensional-array-print-sertain-values/#findComment-1544264 Share on other sites More sharing options...
Psycho Posted March 16, 2017 Share Posted March 16, 2017 You have duplicate data for 'text' and 'value' in each record for your example array, so I'm not sure which one you are wanting to use. Modify as needed foreach($productArray as $idx => $product) { echo $product['text'] . "<br>\n"; } Quote Link to comment https://forums.phpfreaks.com/topic/303463-multidimensional-array-print-sertain-values/#findComment-1544273 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.