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!
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

Jason Blomquist
2,300 PointsAssociative Arrays Challenge #3
My Code looks like this:
<?php $movie = array(); $movie [title] = "The Empire Strikes Back"; ?> <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>
Can you tell me what's wrong with my php command, I tried moving the semi-colon to different spots, but nothing seems to help.
5 Answers

Ernest Grzybowski
Treehouse Project ReviewerIt helps to give us where you encountered the problem. Can you please post which lesson this is from exactly? It's important to know which lesson, because different lessons provide different ways to do the same thing.
Haven't written PHP in a while, but I'm pretty sure this works.
PHP:
<?php $movie = array( "title" => "The Empire Strikes Back", "title_two" => "The Matrix"); ?>
<?php echo 'I have never seen ' . $movie['title'] . ', but I have seen ' . $movie[title_two] ?>
Output:
I have never seen The Empire Strikes Back, but I have seen The Matrix

Jason Blomquist
2,300 PointsIt's from the Associative Arrays Challenge question 3.

Ernest Grzybowski
Treehouse Project ReviewerWhich lesson though? I see the the post title is "Associative Arrays Challenge question 3" but, is it in:
LIBRARY > PROGRAMMING > INTRODUCTION TO PROGRAMMING > OBJECTS AND ARRAYS
or
LIBRARY > PROGRAMMING > BUILD A SIMPLE PHP APPLICATION > CREATING THE MENU AND FOOTER
or
Something else...
Sorry, it just makes it easier to know exactly which lesson you're having trouble on. Thanks

Jason Blomquist
2,300 PointsIt is in :
LIBRARY > PROGRAMMING > BUILD A SIMPLE PHP APPLICATION

Ernest Grzybowski
Treehouse Project ReviewerAll of these have been checked and work
Challenge 1 of 7:
<?php $movie=array(); ?>
Challenge 2 of 7:
<?php $movie=array("title"=>"The Empire Strikes Back"); ?>
Challenge 3 of 7:
<?php $movie=array("title"=>"The Empire Strikes Back"); ?>
<h1><?php echo$movie['title']; ?> (1985)</h1>