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 PHP Basics PHP on the Web Let PHP Do the Work

Code 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

Hi 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.

Ah, a more elegant solution. Thanks, Jason.

sorry 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!

Hi Santis,

Your code is correct but the challenge is requiring that you don't have a space after date and before the (

thx very much...

Haha I made that same mistake with that space after date.

I 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
samanthametcalfe2
5,820 Points

Thanks heaps, this was driving me mad. It was right, I just had to refresh and retype.