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 Date Function

Barak TheProgrammer
Barak TheProgrammer
1,773 Points

I DONT GET IT, why dont he accept that

i've tried put the function afet the comment, and its doing the job either way, but in both ways it doesnt accept it ^!^

index.php
<?php
echo 'Today is '.date ("F d Y");
//Place your code below this comment

?>
Nancy Melucci
Nancy Melucci
Courses Plus Student 36,143 Points

Hey this probably won't be much help...but I adjusted your code like this. And it ran and produced the correct statement Today is January 22, 2017 but it did not pass either. Maybe the instructor or a pro community member can help us both out?

<?php
echo 'Today is ';
echo date('F d, Y')."<br>";
//Place your code below this comment


?>

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Barak Ben-Amram

Nancy's code is correct in that the challenge wants you to use an additional echo statement. If you look at the pre-loaded code in the challenge, there are additional instructions to

//Place your code below this comment

Hi, Nancy Melucci ... You're code is correct, except the challenge did not ask for a <br> tag in the echo statement. Challenges are super picky and very strict. If you add more than what's asked for, it will result in a Bummer! message. So if you delete that part, your code will pass.

echo date('F d, Y');

Keep Coding! :) :dizzy:

Laura Steiner
Laura Steiner
14,396 Points

Hi --

Your code is missing the required comma. The system doesn't like the extra space between date and the first paren (. I believe you do need to add the changes after the comment (which requires another echo ).

When I make those changes, the test passes for me.

Best of luck!

Laura