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 trial

PHP Build a Simple PHP Application Listing Inventory Items Associative Arrays

Titus Ndoka
Titus Ndoka
2,350 Points

I was not sure whether I should concatenate the movie title and the year

So I created an array with a movie title and year as keys, so in echoing the two keys in the same h1 tag, was I supposed to concatenate or echo them in separate php blocks?

While both might be correct, its great if I pass the quiz (getting a 'bummer' each time )- this is the third time I'm retaking it . .

sigh....

movie.php
<?php 
$movie = array();
$movie ["title"] = "The Empire Strikes Back";
$movie ["year"] = 1980;
?>
<h1><?php echo $movie["title"];?><?php echo $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>

2 Answers

kevin jordan
kevin jordan
11,353 Points

Hey Titius -

Yeah - if i remember correctly this one is really picky about syntax. Double check the question - i think you need the parentheses around the year - something like this :

<h1><?php echo $movie["title"];?><?php echo  "(" . $movie["year"] . ")";?></h1> 

Hope this helps !! kj