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

Confused

I've tried to solve this several ways each way I've tried correctly printed out the date but it keeps saying I've forgotten the echo command.

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

3 Answers

Mike Costa
PLUS
Mike Costa
Courses Plus Student 26,362 Points

Your formatting is correct, but have you tried just echoing the date (no variables involved) after the comment?

Well I tried

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

and it gives me "Bummer! You have not passed the correct string for formatting"

Honestly the challenges are the least intuitive process of Treehouse :| everything else is super enjoyable but this keeps happening with these challenges, despite having several ways I could reach the end result it only wants one way and I end up wasting a ton of time trying to get help on the forums each time :|

Figured it out on my own, escape character in my date function was was the issue.

Mike Costa
PLUS
Mike Costa
Courses Plus Student 26,362 Points

One of the best things I love about programming is knowing there are multiple solutions to a problem. Some are more efficient than others and I always try to find the most efficient way even after I have solved the issue at hand. Don't be discouraged if your solution doesn't work, even if its one of the correct solutions. Just try to think outside the box to see if you can find a different way to solve it.