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

What's wrong here?

When I click Preview, it outputs exactly what the instructions say it's supposed to output, but when I check work it says I forgot the echo command.

index.php
<?php

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


?>

1 Answer

Daniel Stopka
Daniel Stopka
13,520 Points

Hi,

I assume, that it wants cleaner code. To be more precise, if you are echoing a single variable, it is not necessary to be inside double quotes although the variables inside double quotes are expanded... so try:

echo $today;

It still says that I forgot the echo command.

Daniel Stopka
Daniel Stopka
13,520 Points

ahh yeah, I reviewed it, and we need to do exactly what is asked in instructions... do not delete the first line and write code to display the rest... So at first line you have "Today is " that continue and echo just the date and you should be fine...

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