Francis (sicnarf) wrote in _are_you_a_dork,
Francis
sicnarf
_are_you_a_dork

If the year is divisible by 4 but not 100 or is divisible by 400, we have a leap year.

<?php

$thisYear = 2008;

if ($thisYear % 4 == 0 && $thisYear % 100 != 0 || $thisYear % 400 == 0)
  echo $thisYear . " is a leap year. :D";
else
  echo $thisYear . " is not a leap year. D:";

?>
Subscribe
  • Post a new comment

    Error

    Comments allowed for members only

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 2 comments