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

Answer Posted / prakash.matte

<?php
$dob = '29-05-1986';
$age = date('Y') - date('Y', strtotime($dob));
if (date('md') < date('md', strtotime($dob))) {
$age--;
}
echo $age;
?>

Is This Answer Correct ?    5 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the method available in form submitting?

535


Define soundex()?

517


Is it easy to learn php?

516


What is the tags in PHP is not a valid way to begin and end a PHP code block?

803


What is singleton pattern in php?

494






What is the difference between $var and $$var?

562


Where are cookies stored php?

509


How escape single quotes php?

494


What is htmlentities function in php?

517


What is the functionality of the functions strstr() and stristr()?

531


Which is the best php framework for a beginner?

534


What is the difference between explode() and split() functions?

510


What is an object in php?

560


What was the old name of php?

974


Why sessions are used in php?

512