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

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)