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

Alex Bauer
Alex Bauer
9,426 Points

Why does it tell me that I forgot my echo command?

I can't change the code above the variable named $today, I also used an echo for that variable in order to include the date after the previously written string.

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

2 Answers

Steven Parker
Steven Parker
231,248 Points

While this solution would be functional, the challenge wants you to do it with a single line. Try it without creating the intermediate variable.

Alex Bauer
Alex Bauer
9,426 Points

Oh okay thank you! I only tried it that way because the video I watched before showed the instructor creating a variable first. I should've read the instructions correctly. I appreciate your help a lot.

skip the variable and echo the date function returned value :

echo date("F d, Y");
Alex Bauer
Alex Bauer
9,426 Points

Oh okay thank you! I only tried it that way because the video I watched before showed the instructor creating a variable first. I should've read the instructions correctly. I appreciate your help a lot.