* "Ryan A" <[EMAIL PROTECTED]>:
> This is the code I am using to display a persons age from the mysql db:
>
> $day1=strtotime($age);
> $day2 = strtotime(date("Y-m-d"));

Just to be pedantic... just use time() for the above statement; no
reason to do extra work here. (date() will actually call time() anyways)

> $dif_s = ($day2-$day1);
> $dif_d = ($dif_s/60/60/24);
> $age = round(($dif_d/365.24));

And, as someone else mentioned, you want to do floor() here, as somebody
is 16 until their 17th birthday.

-- 
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to