Zend - The PHP Company




Math

Add Code


age calculator  

Type: application
Added by: jakeandjemma
Entered: 21/02/2006
Last modified: 02/12/2005
Rating: - (fewer than 3 votes)
Views: 4760
Age calculator (which works)


<?php 
# Age script 
# based on (c) hagman 1998-2002 
# at http://www.zend.com/codex.php?id=842&single=1, This one works - though!!!

function age_calculator($day,$month,$year){
if (
date("n") > $month$age = (date("Y") - $year);
elseif (
date("n") == $month){
  if (
date("j") < $day$age = (date("Y") - $year) - 1;
  else 
$age = (date("Y") - $year);
  } 
else 
$age = (date("Y") - $year) - 1;
  return 
$age;
}
?>


Usage Example




Rate This Script





Search



This Category All Categories