PHP How to find age?

1

PHP How to find age?

I have birthdate in php standard format.. How do I find age for the date?

Created by programmer 21 weeks 2 hours ago – Made popular 21 weeks 2 hours ago
Category:   Tags:

Answers to the above Question:

0

Following age function may help.

<php>

 <?php
function age($date_of_birth){
$dob =date('Y-m-d', strtotime($date_of_birth));
$age = date('Y') - date('Y', strtotime($dob));
if (date('md') < date('md', strtotime($dob))) {
$age--;
}
return $age;
}

?>

</php>

 

Therefore, as an example:

See the example below to use the function

 <php>

<?php

$age=age('2-09-1950');

echo $age;
?>
</php>

 

Read »
Created by HadaclEaf 21 weeks 2 hours ago
Category:   Tags: