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

Please help in this step

Any suggestion will be appreciated. I am stuck in the step 5 of this challenge.

Right now, the <h1> element has the year of the original movie as a static piece of text. Replace that with a PHP command that INSTEAD displays the year of the new movie from the array. (Be sure to leave the parentheses intact.)

So far this is where I am.

<?php $movie = array("Back to the Future (1985) Director Robert Zemeckis ");

?> <?php $movie = array( "title" => "The Empire Strikes Back" ); ?> <h1><?php echo $movie["title"]; ?> (1985)</h1> <?php $movie = array("title"=>"The Empire Strikes Back", "year"=>1980); ?>

<table> <tr> <th>Director</th> <td>Robert Zemeckis</td> </tr>

1 Answer

Navid Mirzaie Milani
Navid Mirzaie Milani
6,274 Points

just add the date as a element in an array like you did with title ;) i don't know that they really want you to return a date object or just a string like 1985. But if not you can just say

$movie = array("title'=>'this is my title', 'year'=>'1985', 'director'=>'Robert Zemeckis'); 

this issue was already solved check it out here:)

https://teamtreehouse.com/forum/stuck-on-task-5-of-7-for-associative-arrays