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

Answer Posted / sandhya

<?php
$date1 = time();
$date2 = mktime(0,0,0,02,01,1979);
$ddif = $date1 - $date2;
$age = floor(($ddif/(60*60*24))/365);
echo $age;
?>

Is This Answer Correct ?    0 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are magic constants in php?

568


What is encapsulation in php?

563


how to track no of users logged in?

602


What does the php error 'parse error in php - unexpected t_variable at line x' means?

623


How to include a file code in different files in php?

512






What are the popular frameworks in php?

530


Which is the latest version of php?

549


What are the methods useful for method overloading?

531


What is $_ get?

533


What is difference between rest and http?

520


What is the role of php.ini file?

549


What does echo mean in php?

559


How to connect to mysql from a php script?

562


What are the characteristics of php variables?

527


Which php function will attach one file to another?

533