Hello once again.
I want to compute for the age of a certain person. Here is the script:
<?php
$ybday=1987;
$mbday=1;
$ybday=3;
$imrmn = "$ybday-$mbday-$dbday";
$age = date('Y') - date('Y', strtotime($imrmn));
if (date('md') == date('md', strtotime($imrmn)))
{
$age++;
}
else if (date('md') < date('md', strtotime($imrmn)))
{
$age++;
}
$computed_age = $age;
echo $computed_age;
?>
The script works, but the problem is say for example Today is January 2, 2010. Like in the script the input is January 3, 1987, however the output is already 23. It should be 22 only because its only January 2 today.
What seems to be the problem?