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

Replace the old movie title with array element, while keeping HTML elements.

http://teamtreehouse.com/library/programming/build-a-simple-php-application/listing-inventory-items/associative-arrays

These challenges are difficult at best. I had this code in here for a while, but I was missing ONE SPACE and it would not accept it lol. This is correct, just thought I would pass it along to help people in the future.

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

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

1 Answer

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

I'm working on re-writing the hints to be more helpful, but I do think it's important to preserve all the spaces when you replace static HTML with dynamic PHP. This doesn't look bad in code ...

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

... but this looks bad in the browser without a space, and a product owner, a client, or a site visitor would notice the missing space here:

The Empire Strikes Back(1985)