Saturday, 7 September 2013

PHP Merging Arrays and presenting output in dot points

PHP Merging Arrays and presenting output in dot points

The output of the following code gives: MilkYoghurtCheese
AppleOrangeBanana. Being new to php, I am having difficulty producing
these elements as dot points in a list, rather than combined words in a
sentence.
Is there a way to put these into dot points?
<?php
$newArray =array();
$DairyArray=array();
$FruitArray=array();
$DairyArray= array(
'1' => 'Milk',
'2' => 'Yoghurt',
'3' => 'Cheese',
);
$FruitArray = array(
'9' => 'Apple'
'10' => 'Orange',
'11' => 'Banana',
if ($_POST['Dessert'] == 'Yes') //This represents the condition that a
checkbox is
checked
{
$newArray = array_merge($DairyArray, $FruitArray);
foreach ($newArray as $key => $value)
{
echo $value >;
}
}
What I am trying to achieve as output:
• Milk • Yogurt • Cheese • Apple • Orange • Banana
Any help would be greatly appreciated, and I will try to see if I can
answer some of your questions too.
Thanks
Andrew

No comments:

Post a Comment