Skip to content

Instantly share code, notes, and snippets.

@krutz27
Created October 4, 2013 13:33
Show Gist options
  • Select an option

  • Save krutz27/6825989 to your computer and use it in GitHub Desktop.

Select an option

Save krutz27/6825989 to your computer and use it in GitHub Desktop.
//CALCULATE AGE
function birthday ($birthday){
list($year,$month,$day) = explode("-",$birthday);
$year_diff = date("Y") - $year;
$month_diff = date("m") - $month;
$day_diff = date("d") - $day;
if ($day_diff < 0 || $month_diff < 0)
$year_diff--;
return $year_diff;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment