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 trialcleancoder
8,307 PointsMy array is not passing. Help!
I am working on Task 2 of 7 in the Build a Basic PHP Website course and thought this array I created would pass, but somehow it's not and I'm not sure what I'm doing wrong.
<?php
$movie = array();
$movie[] = ["title" => "The Empire Strikes Back"];
?>
<h1>Back to the Future (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>
3 Answers
Simon Coates
28,694 Pointstry
<?php
$movie = array();
$movie["title"] = "The Empire Strikes Back";
?>
<h1>Back to the Future (1985)</h1>
for task2. I've obviously ommitted some HTML, but you get the idea.
cleancoder
8,307 PointsTHANK YOU SIMON! Very helpful and thanks for your prompt reply. It's passing now. :)
Simon Coates
28,694 Pointscool. i wasn't sure if your uncertainty was about the syntax or what exactly the test wanted. You might have been thinking of syntax like:
<?php
$movie = ["title" => "The Empire Strikes Back"];
?>
<h1>Back to the Future (1985)</h1>
cleancoder
8,307 PointsIt was the syntax that I was unclear on, but I was really trying to do too much. When I took a look at your answers, I simplified my approach and the syntax was then accurate. Your first answer showed me what I was missing.
Simon Coates
28,694 PointsSimon Coates
28,694 PointsTo demonstrate the difference in the event of any uncertainty:
produces: