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 trialSherrie Gossett
14,924 PointsCode yields correct answer, but quiz won't accept it
I've answered this quiz in a number of ways; each time the preview indicates the answer is correct, but the quiz rejects it. Ideas?
<?php
echo 'Today is ';
//Place your code below this comment
echo date('F d' . ", " . 'Y');
?>
or....
<?php
echo 'Today is ' . date("F d" . ", " . "Y");
?>
4 Answers
Jason Anello
Courses Plus Student 94,610 PointsHi Sherrie,
Your first attempt is closer. The challenge is expecting 2 separate echo statements.
The problem is that the challenge is expecting the format string to be a single string and not built up with concatenation.
echo date('F d, Y');
What you had will produce the same result but not exactly what the tester is looking for.
Santis Smagars
980 Pointssorry guys..still dont get it..what is wrong with if i write this
<?php
echo 'Today is ';
//Place your code below this comment
echo date ('F d, Y');
?>
Thx!
Jason Anello
Courses Plus Student 94,610 PointsHi Santis,
Your code is correct but the challenge is requiring that you don't have a space after date
and before the (
Santis Smagars
980 Pointsthx very much...
Armando Rosas
4,505 PointsHaha I made that same mistake with that space after date.
Kristian Skoglund
1,146 PointsI might mention that even tho i had the exact same answer it would not accept it as correct. Most probably because php can sometimes get stubborn and you will need to re-type your code to get it to work, as was the solution in my case.
If you can't get it to work with "echo date('F d, Y');" then reload the page, delete the code and type it once again.
samanthametcalfe2
5,820 PointsThanks heaps, this was driving me mad. It was right, I just had to refresh and retype.
Sherrie Gossett
14,924 PointsSherrie Gossett
14,924 PointsAh, a more elegant solution. Thanks, Jason.