How to Calculate Age from Date of Birth in PHP?
Now, let's see tutorial of how to calculate age from date of birth in php. step by step explain calculate date of birth from age in php. I’m going to show you about php age calculation from date of birth. you'll learn php calculate age from date of birth to today.
I will give you very simple example how to calculate age from date of birth in PHP. so let's see both examples with output:
$year = (date('Y') - date('Y',strtotime($dob)));
$dob = new DateTime('1994-07-01');
$today = new DateTime('today');
$year = $dob->diff($today)->y;
i hope it can help you...
We are Recommending you
- How to Check If Date is Past Date in PHP?
- How to Get Month Name from Date in PHP?
- How to Get Full Day Name from Date in PHP?
- How to Get Previous Month from Date in PHP?
- How to Get Next Month Date in PHP?
- How to Get Tomorrow Date in PHP?
- How to Get Yesterday Date in PHP?
- PHP Subtract Seconds from Time Example
- How to Subtract Minutes from DateTime in PHP?
- How to Subtract Hours from DateTime in PHP?