How can I loop through the array below with PHP in order to to display the list? There may be more than 7 items in the list. Should I use foreach
, while
?
My desired output is:
APPLE
PEAR
BANANA
etc
Here is the array structure:
Array
(
[main_category] => Array
(
[0] => APPLES
[1] => PEARS
[2] => BANANAS
[3] => PEACHES
[4] => ORANGES
[5] => KIWIS
[6] => PASSION FRUITS
)
)