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 trialWalter Cortez
4,071 PointsCan't find code...
<?php echo 'Today is '; //Place your code below this comment echo $today = date("F, j, Y"); ?>
<?php
echo 'Today is ';
//Place your code below this comment
echo $today = date("F, j, Y");
?>
1 Answer
Jacob Herrington
15,835 PointsHi Walter,
You were headed in the right direction on this one.
First, your variable $today is not necessary, so go ahead and get rid of that. We don't want too many variables, it is sloppy and can cause problems.
Second, the date function is parsing the commas - so your code is outputting: "Today is September, 27, 2016". The comma after September is unwanted.
Also, the 'j' flag, according to the PHP documentation returns the "Day of the month without leading zeros", whereas the challenge asked for leading zeros. You needed to use the 'd' flag.
Here is your line of code passing:
echo date("F d, Y");
Walter Cortez
4,071 PointsWalter Cortez
4,071 PointsThank you for explaining that to me Jacob...I see now what you mean!
Happy coding!