使用php检索不同年份

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; }

There is no problem in your code. To check the version of your PHP, Create a php file and inside it, use phpinfo(). Run it and it will show all the details of your PHP.

<?php
    phpinfo();

enter image description here