public function getAge(string $birthday): int { return (new \DateTime('now'))->diff(new \DateTime($birthday))->y; } echo getAge('1982-08-22');
Enjoy