[Solved] PHP Date issues [duplicate]


Here is a simple function to do that

//birthday YYYY-MM-DD
function userInfo($fname, $lname, $birthday) {
   //Calc age 
   $age = date_diff(date_create($birthday), date_create('today'))->y;  
   return $fname ." ". $lname . " ".$age;
}

now call it

echo userInfo('John', 'Doe', '1986-02-01');

1

solved PHP Date issues [duplicate]