public function getAge($date)
{
$dob = new DateTime($date);
$now = new DateTime();
$difference = $now->diff($dob);
$age = $difference->y;
return $age;
}
$dateOfBirth = "15-06-1995";
$today = date("Y-m-d");
$diff = date_diff(date_create($dateOfBirth), date_create($today));
echo 'Your age is '. $diff->format('%y');
$dateOfBirth = "17-10-1985";
$today = date("Y-m-d");
$diff = date_diff(date_create($dateOfBirth), date_create($today));
echo 'Age is '.$diff->format('%y');