不明白我是如何得到结果的

Dont understand how i get the result

PHP 帮助 请你试着向我解释一下,当我制作一个结果正确的网站时会发生这种情况,但我无法弄清楚结果是如何真实的

enter <title><?php echo $user_session; $age = 2015 - $sql_user_info['dateofbirth']; echo " ".$age;?> | OCRCSITE</title> here

我正在尝试获取用户的年龄,我成功了,但当数据库中的年龄为 1996-01-22 时,我不知道结果如何正确 如果您能解释一下,我将很高兴。

这是因为 PHP 将字符串转换为数字的方式。字符串 "1996-01-22" 被计算为数字 1996。因此,2015 - 1996 = 19。可以在此处找到更多信息:http://php.net/manual/en/language.types.type-juggling.php