snow Posted September 12, 2007 Share Posted September 12, 2007 Hi sorry for another topic, just in dire help. Here is my array stored in menu_data.php: <?php $days = array(); function myarray() { global $days; $days = array ( "Monday"=>array ( "Chicken Burger", "Veal Schnitzel", "Onion Rings", "Hot Potato" ), "Tuesday"=>array ( "Steak Sandwich", "Chicken Pasta", "Pork Chop", "Taco" ), "Wednesday"=>array ( "Chicken and Chips", "Beef Casserole", "Pasta", "Lasagne" ), "Thursday"=>array ( "Fish and Chips", "Tuna Pattie", "Chicko Roll", "Hot Dog" ), "Friday"=>array ( "Nachos", "Tuna Pattie", "Maccaroni Cheese", "Bacon and Eggs" ) ); } ?> and I use this array to print a menu from it on print_menu.php: <?php include("menu-data.php"); myarray(); // Print menu. echo "<h1><u>Menu</u></h1>"; foreach ($days as $day => $meals) { echo "<li><b>" . $day . "</b><ul>"; foreach ($meals as $meal) { echo "<li>" . $meal . "</li>"; } echo "</ul></li>"; } ?> This is for a university assignment, now all of a sudden they've gone: Stage 6 - Prices Modify menu_data.php so that it also stores the prices for the courses. Hint: You will probably need to add an extra array to do this. Modify print_menu.php so that it displays prices next to the courses. So basically I need to print out a menu, that displays the day, then under that, the menu for that day as well as how much each order costs. I am really confused working with more then 2 arrays in one. Can anyone please help in doing this. Thank you very much. Link to comment https://forums.phpfreaks.com/topic/69039-solved-help-with-modifying-an-array/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.