Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDon Shipley
19,488 Pointschallenge task 3 of 7
What am I suppose to do? Do not understand how to keep the same or change the variable in a key
5 Answers
Tom Schinler
21,052 PointsThe code should look like this
<?php
$movie = array(
"title" => "The Empire Strikes Back"
);
?>
^ this is the array
<h1><?php echo $movie ["title"]?> (1985)</h1>
and this should be what the first level header looks like. When you echo out $movie and pass in the key of ["title"] the server is going to add the appropriate html.
Tom Schinler
21,052 PointsHey Don, It seems this part of the challenge is asking you to replace the title of the movie currently in the <h1></h1> tags with the name of the movie stored in the php array. Try replacing what is inside of the H1 tags with a php code block echoing the name of the film inside the array.
Don Shipley
19,488 PointsIf I place this code it reads, Bummer! The title of the second movie is not displayed in the <h1>. if this <h1<?php $movie["title"], "Back to the Future (1985)" ; ?></h1> Bummer! The title of the second movie is not displayed in the <h1>. This <?php $movie = array(); $movie["title"] = "The Empire Strikes Back"; $movie[] = "Back To The Future (1985)"; foreach ($movie as $newMovie){ ?> <h1><?php echo $newMovie; ?></h1> <?php } ?> reads Bummer! It looks like the title of the second movie is in the <h1>, but something else isn't quite right. Double-check the parentheses and the year.
Don Shipley
19,488 PointsRe watched the videos several times. I do not know how to create a key than change the variable to read without creating a new key.
Don Shipley
19,488 PointsThat worked I did something wrong. Thank you very much
Don Shipley
19,488 PointsDon Shipley
19,488 PointsThank you I will give that a try..
Don Shipley
19,488 PointsDon Shipley
19,488 PointsBummer! Try again!