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

DENVER MARTINEZ
DENVER MARTINEZ
1,824 Points

Cannot figure out Task for PHP Basics. It is outputting correctly but when I "Check code" it says I forgot the echo.

I cannot get past this Challenge Task. When I look at my code output preview it is bringing up today's date correctly and in the format that is requested in the task. However, when I check to code, it keeps saying "Bummer! looks like you forgot the echo command". It is clearly there though. What am I missing here?

Thanks in advance.

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

1 Answer

Antonio De Rose
Antonio De Rose
20,884 Points

I think this question is expecting to print the values on the fly, using the date function, and not saving into variables.

<?php
echo "Today is ";
//Place your code below this comment
/*$month = date('F');
$day = date('d');
$year = date('Y');*/
//echo $month. " " . $day. ", ". $year;
echo date('F d, Y')

?>
DENVER MARTINEZ
DENVER MARTINEZ
1,824 Points

That was it! Thank you so much man!