<?php
class Student {
  public $name;
  public $dob;
  
  public function getAge() {
    $year = (date('Y') - date('Y',strtotime($this->dob)));
    return $year;
  }
}



$student1 = new Student();
$student1->name = "Alice";
$student1->dob = '1943-04-20';

$student2 = new Student();
$student2->name = "Bob";
$student2->dob = '1996-06-20';



echo $student1->getAge();  // Output: 90
echo $student2->getAge();  // Output: 80


?>