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 trialBryan Woodard
5,757 PointsWhy is this giving me an error message?
I am trying to run the code, I dont know what I am doing wrong.
'''
<?php
$movie = array (
"title" = "The Empire Strikes Back"
);
?>
<h1>"(1985)"</h1>
<h1><?php echo $movie["title"]; ?> (1985)</h1> '''
3 Answers
Jeff Busch
19,287 PointsHi Bryan,
Which question are you on?
Jeff
Bryan Woodard
5,757 PointsIt was: Project -build a simple php application , code challenge : associative arrays
geoffrey
28,736 PointsThere is a problem on the way you assigned the title of the movie with the key. You use the equal sign instead of using equal and greater than signs =>
Here is the way I did this.
<?php
$movie = array();
$movie["title"] = "The Empire Strikes Back";
?>
<h1><?php echo $movie["title"];?> (1985)</h1>
With the way you created your array you should do this
<?php $movie = array ( "title" => "The Empire Strikes Back") // not just the equal sign.
); ?>
<h1><?php echo $movie["title"]; ?> (1985)</h1>
Hope it helps.