PHP help: calculating the user's age?

Daniel

New member
I need help creating a PHP doc that will calculate the user's age in years. I've set the date() function:

$current_year = date('Y');

and I've created a doc with an HMTL form where the user enters a their date of birth as 4 integers (YYYY) to create a $yob variable.

Once POST form data has arrived at the server how can I subtract the user's year of birth from the current year to create an $age variable?

Thanks for any help!
 
Back
Top