Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!