Skip to content

Instantly share code, notes, and snippets.

@AntoineAugusti
Last active December 12, 2015 08:39
Show Gist options
  • Save AntoineAugusti/4745670 to your computer and use it in GitHub Desktop.
Save AntoineAugusti/4745670 to your computer and use it in GitHub Desktop.
<?php
function age($naiss)
{
list($jour, $mois, $annee) = split('[/]', $naiss);
$today['mois'] = date('n');
$today['jour'] = date('j');
$today['annee'] = date('Y');
$annees = $today['annee'] - $annee;
if ($today['mois'] <= $mois)
{
if ($mois == $today['mois'])
{
if ($jour > $today['jour'])
{
$annees--;
}
}
else
{
$annees--;
}
}
return $annees;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment