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

still no luck on this one

Hi, task 5 I have tried code from the forum and I can't get this to pass. any suggestions?

<?php $movie = array( "title" => "The Empire Strikes Back", "year" => "1980" ); ?>

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

//not sure why it seems to cut off my angle bracket h1 angle bracket in this forum. It is there when I enter text in the forum box

Hi Paul,

The forum will strip out html.

Here's some tips on how to post code in the forums.

https://teamtreehouse.com/forum/posting-code-to-the-forum

4 Answers

It looks like you've lost the space between the movie and the year.

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

There's a space before the left parenthesis.

Jason, Thanks for the link to presenting code on-line. Very valuable. I will try what you have suggested.

Hey Jason, you're an Einstein! It worked! Yippie! Hooray! Wahoo! didn't know space was so critical- wondering if it is just these lessons or all PHP. Best, P.

It's not a php thing. It doesn't matter to php whether there's a space there or not. Your code didn't have an error in it.

The space is there for us to make it easier to read.

The original output from the h1 was Back to the Future (1985)

When you added in the echo statements you didn't preserve that space between the movie and left parenthesis before the year.

Your output would have been The Empire Strikes Back(1980) with no space between the movie and year. Making it a little harder to read.

I think the code challenge is simply making sure you preserved that space when adding in your echo statements.

Right, thanks for clarifying.