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 trialTrevor Jones
1,962 PointsPHP Basics date code challenge problem: I believe I'm concatenating the date function correctly, but I get errors.
The error I receive is "use the date function" but I haven't done anything different from the last assignment.
<?php
//Place your code below this comment
echo 'Today is ' . date ("F d \, Y" );
?>
1 Answer
Kent Åsvang
18,823 PointsI don't know exactly what you did wrong, but it seems like the escape-slash threw off the code. This worked for me :
<?php
echo 'Today is ' . date("F d, Y");
?>
Trevor Jones
1,962 PointsTrevor Jones
1,962 PointsThank you Kent. I'll give it a try.
Trevor Jones
1,962 PointsTrevor Jones
1,962 PointsThat worked! Thank you. I'm not sure why but I assumed because it had directly asked that a comma be added that I need to provide an escape character to allow it.
The output was still outputting the correct answer, however. So that's what really threw me. Either way though, I appreciate your help!
Kent Åsvang
18,823 PointsKent Åsvang
18,823 PointsThe output is correct with or without the backslash - my guess is that the code tth has written to verify the challenge only checks your input, and has not taken account for escape-characters.