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 Basic PHP Website (2018) Listing and Sorting Inventory Items Associative Arrays

Cliff Jackson
Cliff Jackson
2,887 Points

Code will not pass challenge??

Cannot get the code to pass, second time i've posted the problem any ideas?

index.php
<?php
$movie = array (
"title" => "The Empire Strikes Back."
);
?>
<?php echo "<h1>". $movie ["title"] ."(1985)</h1>";?>

<table>
  <tr>
    <th>Director</th>
    <td>Robert Zemeckis</td>
  </tr>
  <tr>
    <th>IMDB Rating</th>
    <td>8.5</td>
  </tr>
  <tr>
    <th>IMDB Ranking</th>
    <td>53</td>
  </tr>
</table>

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! While PHP isn't terribly picky about whitespace this is one of those "make or break" cases and, in this case, it is breaking your code. You have an extraneous space between $movie and ["title"] removing the space between these two causes the code to pass Step 3 of the challenge.

Hope this helps! :sparkles:

Cliff Jackson
Cliff Jackson
2,887 Points

Thanks Jennifer spot on as always.