· 1 min read

How to Calculate Age with PHP

Calculate age in PHP

$your_birthday = '1982-08-29';
$difference = date_diff(date_create(), date_create($your_birthday));
$age      = $difference->format('%Y');
// 35

Short and sweet

1 comment

  • Email

    I honestly thought this was going to be a dig at PHP 😂 Hope all is well back in VT sir! https://blog.toggl.com/save-princess-8-programming-languages/

Leave a comment