Jump to content

[SOLVED] Determining someones age with php


philip@hux.co.za

Recommended Posts

hello all i need to determine someones age from there DoB i am currently using this bit of code but it keeps giving the wrong answer

 

//Works out the Age of Person

 

                $idyear = $iddate[0].$iddate[1];

                $idmonth = $iddate[2].$iddate[3];

                $idday = $iddate[4].$iddate[5];

                $d1=mktime(0,0,0,$idday,$idmonth,$idyear);

                $d2=mktime(0,0,0,date("d"),date("m"),date("y"));

        echo "Your age is ".floor(($d2-$d1)/31536000) . "<br>";

 

Please help

Link to comment
https://forums.phpfreaks.com/topic/71665-solved-determining-someones-age-with-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.