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 include a file code in different files in php?

505


How to get the http request in php?

568


How do I find environment variables?

500


Why die is used in php?

549


How to set session.gc_divisor properly?

585






What is curl php?

527


How is it possible to set an infinite execution time for php script?

515


Whether it is possible to share a single instance of a memcache between multiple php projects?

524


What is different types of visibility?

529


What types of loops exist in php?

532


What is php stack?

516


What is php and its uses?

503


Is php procedural or oop?

550


What is php oop?

507


Is php 5.6 secure?

530