Sorry, I am very new to PHP. I searched for similar problems on Google, but they say it should be no problem if using PHP version 5.2+. I don't know what version that I am using right now. The error message shows like this:
Fatal error: Call to undefined method DateTime::diff() in line 3 at $interval
If I comment-out lines 3 and 4, it can run, but can't retrieve a different date. I only want the year only. Can someone help me figure out what the problem is? Thanks in advance.
$date1 = new DateTime("$bday");
$date2 = new DateTime("now");
$interval = $date1->diff($date2);
$diff = $interval->format('%y-%m-%d');
$dif2 = explode("-",$diff);
$umur = $dif2[0];
if($umur < 10){ $catumur = 1; }
if(($umur > 9)&&($umur < 20)){ $catumur = 2; }
if(($umur > 19)&&($umur < 60)){ $catumur = 3; }
if($umur > 59){ $catumur = 4; }