Results 1 to 6 of 6
Feb 24, 2009, 22:53 #1
- Join Date
- Jun 2008
- 0 Post(s)
- 0 Thread(s)
Help Needed - Only "basic" PHP required.
I've just started a class on PHP for my TAFE course and I'm stuck already. We haven't done much PHP as of yet - learnt about if/else statements, switch statements and some loops but that is all. Now I have a task to do involving determining whether a year is a leap year or not. It does not have user input, just declare $year inside the code.
I've been able to determine whether $year is a leap year when dividing by 4 but am unable to take it more advanced. Part A said to use if/else statements. This is part b (which I'm stuck on):
If a year is evenly divisible by 4, it is a leap year, unless it is divisible by 100. if it is divisible by 100, it is not a leap year unless it is also evenly divisible by 400. if the year is not a leap year, print the number of years to the next leap year.
Anyone have any suggestions?