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 ARRAY (please help I am stuck)

By the end of this code challenge, we'll remove all the information about the original movie ("Back to the future") from the page and replace it with information about the new movie ("The Empire Strikes Back"). Right now the <h1> element has the title of the original movie as a static piece of text. Replace that with a PHP command that instead displays the title of the new movie from the array. (Be sure to leave the <h1>tags and the year intact).

<?php
$movie = ["title" => "Back to the future", "year" => "1985", "director" => Richard Zemeckis", "IMDB Rating" => "8.5", IMDB Ranking" => "53", "title" => "The Empire Strikes Back"];

2 Answers

SVETOSLAV DIMITROV
SVETOSLAV DIMITROV
683 Points

If I got you right this should work:

<h1><?php $movie = ["title" => "Back to the future", "year" => "1985", "director" => "Richard Zemeckis", "IMDB Rating" => "8.5", "IMDB Ranking" => "53", "newtitle" => "The Empire Strikes Back"];

echo $movie["newtitle"]; ?></h1>

Hie, thanks but its not passing am still stuck with that one

SVETOSLAV DIMITROV
SVETOSLAV DIMITROV
683 Points

Could you please provide link to the task