A simple "foreach" question.
Posted: Fri Sep 20, 2002 12:06 am
Hi,
I recently took it upon my self to learn PHP. I picked up a book and am in the middle of a lesson when I ran into a problem I can't seem to fix.
The assignment is to create a multi-demensional array of movie genres and titles for each of those genres, and then print it. I'm geting an error in line 10.
Any help would be much appreciated.
Thanks,
Brandon
I recently took it upon my self to learn PHP. I picked up a book and am in the middle of a lesson when I ran into a problem I can't seem to fix.
The assignment is to create a multi-demensional array of movie genres and titles for each of those genres, and then print it. I'm geting an error in line 10.
Code: Select all
<?php
$db=array
(
array('SF','Terminator','Star Trek','Star Wars','The Matrix'),
array('Action','Indinia Jones','The Mummy','Top Gun','Days of Thunder'),
array('Romance',"You've Got Mail",'Sleapless in Seatle','Gone with the Wind','Bed of Roses')
)
foreach($db as $temp)
(
print("Genere:");
foreach($temp as $name)
print(" $name<br>");
print("<br>");
)
?>Any help would be much appreciated.
Thanks,
Brandon