<?php/** * 根据时间戳计算年龄 * @param $birth * @return mixed */functionhowold($birth) {list($birthyear, $birthmonth, $birthday) = explode('-', date('y-m-d', $birth)); list($currentyear, $currentmonth, $currentday) = explode('-', date('y-m-d')); $age = $currentyear - $birthyear - 1; if($currentmonth > $birthmonth || $currentmonth == $birthmonth && $currentday >= $birthday) $age++; return$age; } ?>
以上就介绍了php根据生日计算年龄(周岁),包括了方面的内容。
相关文章:
php根据生日计算年龄的方法
php根据生日计算年龄/生肖/星座实例
