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

associative arrays challenge 3/7

I have the following:

<?php

$movie = array( "title" => "The Empire Strikes Back", )

?>

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

It gives me the red light (ROXANNE!!!!!, Sorry, had to do it) with this:

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.

Help? If you're a Police fan, that would be a plus.

Can you please post the text of the quiz question too?

3 Answers

you might need to put a space after the title in the echo statement in addition to removing the comma at the end of the array

<?php

$movie = array("title" =>"The Empire Strikes Back");

?>

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

I can't remember the challenge, but from what you've posted here, there is a ',' after 'The Empire Strikes Back". It should be

$movie = array("title" =>"The Empire Strikes Back");

Yep, the space. Oy, Programming sucks. Thanks Stone.

no problem