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

First print the current date of your submission using the date function. (Need Help ASAP)

First print the current date of your submission using the date function.

Then set a string

$myString = “The​ ​quick​ ​brown​ ​fox​ ​jumps​ ​over​ ​the​ ​lazy​ ​dog”;

I want you to check from 2005 to 2015 and find out which year was a leap year.

If it is a leap year then you need to print out: $year​ ​(the​ ​value​ ​of​ ​the​ ​year)​ ​is​ ​a​ ​leap​ ​year THE​ ​QUICK​ ​BROWN​ ​FOX​ ​JUMPS​ ​OVER​ ​THE​ ​LAZY​ ​DOG

If it is not a leap year then you need to print out: $year​ ​(the​ ​value​ ​of​ ​the​ ​year)​ ​is​ ​not​ ​a​ ​leap​ ​year the​ ​quick​ ​brown​ ​fox​ ​jumps​ ​over​ ​the​ ​lazy​ ​dog

if the year is 2015 then you need to print out: The​ ​quick​ ​brown​ ​cat​ ​jumps​ ​over​ ​the​ ​lazy​ ​dog​ ​(you​ ​are​ ​changing​ ​fox​ ​with​ ​cat)

You​ ​need​ ​to​ ​use​ ​built​ ​in​ ​php​ ​string​ ​and​ ​date​ ​functions​ ​to​ ​do​ ​the​ ​uppercase,​ ​lowercase​ ​and replace.​

I really need help with the answer. Please leave it in the comments. I have no Idea where to even start with this. Thank you!

2 Answers

Matti Mänty
Matti Mänty
5,885 Points

To get the current date, just use the php date() function. Then I suppose you should use a for loop to check each year whether it is a leap year and finally print the 2015's print.

Leap years are divisible by 4 (with the exception of years divisible by 100 but not by 400), Wikipedia, but you don't need to worry about years divisible by 100 or 400 in your code. To see if a number is divisible by another number, use modulo. For example 2 % 2 = 0, while 3 % 2 = 1.

This should be more than enough to get you started.

I am looking for the answer. I have class in a couple hours and need this done ASAP, please. someone help me with this and answer the question. Please, I don't need hints, I need the answer. Thank you whoever helps me.

I am looking for the answer. I have class in a couple hours and need this done ASAP, please. someone help me with this and answer the question. Please, I don't need hints, I need the answer. Thank you whoever helps me.