Skip to content

Instantly share code, notes, and snippets.

@benbarber
Last active December 17, 2015 07:48
Show Gist options
  • Save benbarber/5575131 to your computer and use it in GitHub Desktop.
Save benbarber/5575131 to your computer and use it in GitHub Desktop.
Get the age in years from a given date of birth
<?php
$dob = '1965-02-01';
$age_years = floor((time() - strtotime($dob)) / 31556926);
echo $age_years
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment