Alright I have a little trouble with this array.
Let me write the code and explain.
<?php
$fruits = array("S" => array("8am" => "Orange",
"1pm" => "Apple",
"6pm" => "Banana",
"9pm" => "Mango"),
"M" => array("8am" => "Orange",
"1pm" => "Apple",
"6pm" => "Banana",
"9pm" => "Mango"),
"T" => array("8am" => "Orange",
"1pm" => "Apple",
"6pm" => "Banana",
"9pm" => "Mango"));
?>
Ok. What I wanna do is write a script that uses a loop to print out the day, the time and fruit, In this format
Day Time Fruit
I have tried using the following code
foreach ($fruits as $eat) {
foreach ($eat as $key => $value){
echo "$key : $value <br />\n";
}
}
to achieve that but only the time and fruit show up and the name of the day does not. Please help!
Let me write the code and explain.
<?php
$fruits = array("S" => array("8am" => "Orange",
"1pm" => "Apple",
"6pm" => "Banana",
"9pm" => "Mango"),
"M" => array("8am" => "Orange",
"1pm" => "Apple",
"6pm" => "Banana",
"9pm" => "Mango"),
"T" => array("8am" => "Orange",
"1pm" => "Apple",
"6pm" => "Banana",
"9pm" => "Mango"));
?>
Ok. What I wanna do is write a script that uses a loop to print out the day, the time and fruit, In this format
Day Time Fruit
I have tried using the following code
foreach ($fruits as $eat) {
foreach ($eat as $key => $value){
echo "$key : $value <br />\n";
}
}
to achieve that but only the time and fruit show up and the name of the day does not. Please help!