Answers for "php age counting"

PHP
1

calculate person age by birthdate php

public function getAge($date)
    {
        
        $dob = new DateTime($date);
        
        $now = new DateTime();
         
        $difference = $now->diff($dob);
         
        $age = $difference->y;
         
        return  $age;
    }
Posted by: Guest on July-11-2020

Browse Popular Code Answers by Language