
May 16th, 2000, 12:52 PM
|
|
Junior Member
|
|
Join Date: Apr 2000
Posts: 12
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Keep getting "fatal error" at the "if" statement line & nedd some help. Included the problem code bellow ! many thanks in advance !
add together the last two digits of the $year. If result is 10 or more, add the two digits together to reduce them to a single digit. Substract from 10. If answer is 5 use the digit 2.
If year 2000 and beyond* subtract from 9 (instead of 10).
<?php
$byear = 1992;
$first = substr($byear,2,1);* // Use substr to split the digits
echo("$first<br>");
$last = substr($byear,3,1);
echo("$last<br>");
echo("$first + $last");
echo"<br>";
$two = +($first + $last);* // add the 2 digits together
echo("$two");**
echo"<BR> how about it";
if ($two >= 10)* {*******// If $two is* equal to 10 or more, split again************
$first2 = substr($two,0,1);
echo("$first2<BR>");
$last2 = substr($two,1,1);
echo("$last2<BR>");
$third = +($first2 + $last2);**// Add together again
echo"<br>";
echo("$third");*********// Result is one digit
$fourth = - (10 - $third);**// Subtract from10
exit;
} else* {******//* if value of $two is less than 10
$fourth = - (10 - $two);** // Subtract from10
{***********************
}
if ($byear >= 2000) {*** // if year is greater or equal to 2000
$md = - ( $fourth - 1);**// Subtract 1 from $fourth
} else
$md = $fourth; {
}
if ($md == 5) {****//* If $fourth value equals 5, use 2
$md = 2;
else
$md = $fourth;*** // Else use first instance of value $fourth
}
}
?>
|