right, i've to write a small script to check if a year is leapyear or not. i understand that
a) the year or number when divided by 400, 100 and 4, should leave me with a module remainder of 0, correct?
so, if what i've said above is right.......... i wrote this script...... now i'm sure this is probably completly wrong, but i'm a bit new to all this.....
the script is being parsed to a html for by the way.........
[code=php]
<?php
$leap = $x;
$x = $_POST["year"];
if ($leap == (($x%100) == 0 || ($x%400) == 0 || ($x%4) == 0)
{
echo("this is a leap year");
}
else
{
echo("this is not a leap year");
}
?>[/code]
i'm getting an error on line 12, which is just a curley brace, {
am i close here, of way off?
ta
a) the year or number when divided by 400, 100 and 4, should leave me with a module remainder of 0, correct?
so, if what i've said above is right.......... i wrote this script...... now i'm sure this is probably completly wrong, but i'm a bit new to all this.....
the script is being parsed to a html for by the way.........
[code=php]
<?php
$leap = $x;
$x = $_POST["year"];
if ($leap == (($x%100) == 0 || ($x%400) == 0 || ($x%4) == 0)
{
echo("this is a leap year");
}
else
{
echo("this is not a leap year");
}
?>[/code]
i'm getting an error on line 12, which is just a curley brace, {
am i close here, of way off?
ta
Comment