Created
May 5, 2020 05:19
-
-
Save parzibyte/0b9cba70d52bab7a34125248e786020a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function obtener_edad_segun_fecha($fecha_nacimiento) | |
{ | |
$nacimiento = new DateTime($fecha_nacimiento); | |
$ahora = new DateTime(date("Y-m-d")); | |
$diferencia = $ahora->diff($nacimiento); | |
return $diferencia->format("%y"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment