Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to create the PHP Script to Calculate the Age Using the
Inputs Of our Birth date and the Current date?

Answer Posted / king

<?php

//calculate years of age (input string: YYYY-MM-DD)
function birthday ($birthday){
list($year,$month,$day) = explode("-",$birthday);
$year_diff = date("Y") - $year;
$month_diff = date("m") - $month;
$day_diff = date("d") - $day;
if ($day_diff < 0 || $month_diff < 0)
$year_diff--;
return $year_diff;
}

?>

Is This Answer Correct ?    6 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain me is multiple inheritance supported in php?

1025


What is the difference between Split and Explode in PHP?

1008


Can you explain, when to use if-else if-else over switch statements?

965


What is the difference between $message and $$message in php?

945


What is $_ get?

928


What is mvc php?

896


Why we use get in php?

951


Explain what does the unlink() function means?

1032


How can we determine whether a php variable is an instantiated object of a certain class?

922


What is the difference between php and java?

946


Why do we use csrf token?

898


What is the meaning of symbol '$' in jquery?

999


Explain which cryptographic extension provide generation and verification of digital signatures?

957


Who is the father or inventor of php?

1033


Is age interval or ordinal?

901