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

How to return a value back to the function caller?

560


How to reset/destroy a cookie in php?

535


Which is a perfect example of runtime polymorphism?

531


What is $_ get?

533


How can you increase the maximum execution time of a script in php?

521






What are the ways to include file in php?

526


Tell me how to create a session? How to set a value in session? How to remove data from a session?

506


Difference between $message vs. $$Message in php.

589


Is PHP runs on different platforms (Windows, Linux, Unix, etc.)?

531


What are the array functions in php?

530


What are the functions for imap?

597


Why php is better?

543


How to send email using php script?

524


What language is similar to php?

562


Which will check if a function exists?

599