如何使用php计算年龄进入我的年龄 [英] How to calculate year from entering my age using php

查看:114
本文介绍了如何使用php计算年龄进入我的年龄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何使用php计算年龄进入我的年龄。

How can i calculate year from entering my age using php.

示例:

我正在进入我的年龄是24岁。

i am entering my age as 24.

所以我需要得到1985年。

So that i need to get the year as 1985.

提前感谢

推荐答案

如果你知道简单的数学你会知道 2010 - 24 - 1 = 1985 $ year = date(Y) - $ hisage - 1 ...但只是给一个年龄不能准确地推断出他们出生的那一年。例如:

If you knew simple math, you'd know that 2010 - 24 - 1 = 1985 or $year = date("Y") - $theirage - 1... But just giving an age does not accurately deduce what year they were born. For example:

如果日期是2010年12月30日,他们说他们是24岁,你还说他们是1985年出生的,坚强>非常高,他们实际上是在1986年出生的。你不能依靠年龄给你出生一年。

If the date is December 30, 2010 and they say they're 24, you're still saying they were born in 1985 when chances are very, very high that they were actually born in 1986. You cannot rely on their age to give you their birth year.

EDIT
如果不是很清楚:

EDIT If that wasn't very clear:

今天的日期是2010年6月16日。
所以要24岁,我会需要在1985年6月17日至1986年6月16日之间的某个地方出生。这是1985年左右的一半,近一半是1986年,造成非常高的不准确。

Today's date is June 16, 2010. So to be 24 years old, I would have needed to be born somewhere between June 17, 1985 and June 16, 1986. That's near half of the birthyears that would be 1985 and near half that would be 1986, causing a very high inaccuracy.

这篇关于如何使用php计算年龄进入我的年龄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆