<?php
$birthDate = "1984-05-21";
$birthDate = explode("-", $birthDate);
$age = (date("md", date("U", mktime(0, 0, 0, $birthDate[2], $birthDate[1], $birthDate[0]))) > date("md") ? ((date("Y")-$birthDate[0])-1):(date("Y")-$birthDate[0]));
echo "Age is: ".$age;
?>
As seen on http://stackoverflow.com/questions/15341767/calculate-age-with-php-in-yyyy-mm-dd-format