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

Viewing The Answer

I did the code correct, but I guess it was done in a different way, but it shows up as the answer in the example, but because it doesn't match 100% with the way you guys did it, it says its wrong. Which prevents you from moving on. Which is a drag because If I dont know the way you did it. It should be a way to where you can view the answer, so the user could move on to the next challenge.

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

?>

2 Answers

Benjamin Larson
Benjamin Larson
34,055 Points

Your code does produce the correct output, I think it's failing because you are over-complicating the syntax for the date() function, which does some fancy internal string parsing that negates the need to concatenate all those small strings and thus could be condensed into the more readable:

<?php
echo date('F d, Y'); 
?>

Thanks Benjamin, I will try that, I just wish I could view the final answer

Benjamin Larson
Benjamin Larson
34,055 Points

I agree that at times it would seem very nice to have access to the correct answers, but at the same time I think it's helpful, even in the learning stages, to be forced to look for the answer. I think the temptation would be too great for people to simply look at the answers at the first sign of difficulty, rather than doing the hard work to spend more time thinking and evaluating, looking closer at previous examples, looking up documentation, using search engines to find similar problems or finally asking questions in forums. In real life, there's no answer section, so it's good practice to start learning that now and not becoming dependent on an answer sheet. Asking questions is a legitimate means of arriving at an answer in the real world, but typically an answer key is not :)