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

Andrea Emili
Andrea Emili
2,479 Points

Can't resolve code test

Hi, i'm trying to complete the challenge, but i can't see my error.

The code i provide is <?php

$movie = array (); $movie["title"] = "The Empire Strikes Back"; $movie["year"] = "(1985)";

?>

<h1><?php echo $movie["title"]; . $movie["year"]; ?></h1> [...]

I've tried to set the year value to 1985 (without parentheses), and write down echo $movie["title"] . "(" . $movie["year"] . ")" ; but nothing happened...

How i can resolve the test?

3 Answers

Gregory Serfaty
Gregory Serfaty
37,140 Points

Hello You can not do this <?php echo $movie["title"]; . $movie["year"]; ?> [...] Because you have a semicolon after the title try this <?php echo $movie["title"] . " " . $movie["year"]; ?>

<?php echo $movie["title"]; . $movie["year"]; ?> here you have a dot after the semicolon, you should delete that,your code should look like this ```<?php echo $movie["title"]; echo $movie["year"]; or echo $movie["title"] . " " . $movie["year"]; ?>

Andrea Emili
Andrea Emili
2,479 Points

Thanks a lot, it works!