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 trialclint cotchobos
6,593 Pointsi need help
4 0f 7 code challange
<?php
$movie = array(
"title" = "The Empire Strikes Back";
"year" = "1980";
)
?>
<h1><?php echo $movie["title"] . ("1985"); ?></h1>
<table>
<tr>
<th>Director</th>
<td>Robert Zemeckis</td>
</tr>
<tr>
<th>IMDB Rating</th>
<td>8.5</td>
</tr>
<tr>
<th>IMDB Ranking</th>
<td>53</td>
</tr>
</table>
4 Answers
Ron McCranie
7,837 PointsThere are a few things wrong with what you have.
1) You're not using the $movie['year']
you still have 1985
2) The parenthesis need to be in quotes
3) The dots go between the php variables and the strings in parenthesis.
Take a look at what I have.
<?php
$movie = array();
$movie['title'] = "The Empire Strikes Back";
$movie['year'] = "1980";
?>
<h1><?php echo $movie['title']." (".$movie['year'].")"; ?></h1>
<table>
<tr>
<th>Director</th>
<td>Robert Zemeckis</td>
</tr>
<tr>
<th>IMDB Rating</th>
<td>8.5</td>
</tr>
<tr>
<th>IMDB Ranking</th>
<td>53</td>
</tr>
</table>
Robert Richey
Courses Plus Student 16,352 PointsAn associative array can be initialized with a set of comma separated key => value
pairs like this
<?php
$foo = array("food" => "bacon", "vehicle" => "car");
echo $foo["food"]; // bacon
echo $foo["vehicle"]; // car
?>
thomascawthorn
22,986 PointsWhat's your question? What's the code challenge question? What was the question before this? Be specific :-)
alex mattingley
7,508 PointsHello :)
You need to make sure that you are specific with your questions! what error are you getting? what have you tried changing so far? What exactly is question 4 of 7? We might be code geniuses (or novices in my case) but we definitely have not mesmerized all of the questions!
Anyhoo, good luck, I think the above answers should cover it!
Robert Richey
Courses Plus Student 16,352 PointsRobert Richey
Courses Plus Student 16,352 PointsHi Ron,
Step 4 / 7 is still using '(1985)' and completed successfully for me with this line
<h1><?php echo $movie["title"]; ?> (1985)</h1>