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

Code challenge editor keeps telling me I forgot to type the echo command

It's actually correct, but I can't get to understand how the editor wants me to type it.

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

2 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

Hi Julio,

As you say there's nothing really wrong with the code you've written but as you'll learn as you get more comfortable with PHP there's more often than one way of solving a problem.

You're getting the error message because the challenge is expecting a second echo statement and doesn't want any variables. So if you write 2 separate echo commands it'll work.

<?php
echo "Today is ";
//Place your code below this comment

echo date("F d, Y")

?>

Hey Jonathan, It worked!, I tried several ways but for some reason I kept using a variable, the editor should maybe just check the result in a case like this. Thanks for the heads up!