- time: documentation ( source)
- floor: documentation ( source)
<?php
function get_marko_age($birthday) {
$today= time();
$age = ($today - $birthday)/(60*60*24*365);
$float_value_of_age = floor($age);
return $float_value_of_age;
}
echo "My name is Marko and I am <strong>";
echo get_marko_age('1985-01-09'); // here to change date and it automatically show number of years
echo "</strong> years old.";