1 public function getAge($date)
2 {
3
4 $dob = new DateTime($date);
5
6 $now = new DateTime();
7
8 $difference = $now->diff($dob);
9
10 $age = $difference->y;
11
12 return $age;
13 }