PHP DateTime DateInterval isset在var

编程入门 行业动态 更新时间:2024-10-18 18:27:52
本文介绍了PHP DateTime DateInterval isset在var_dump之后更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

此对象中的任何变量都是!isset(),但是如果我是var_dump($ interval)或print_r($ interval),则这些变量将成为isset()。这也适用于empty()/!empty()。

Any variable in this object is !isset() but if I either var_dump($interval) or print_r($interval), these variables becomes isset(). This also applies to empty()/!empty().

因此在$ interval-> i下面的代码中,最初是!isset(),但在我之后是isset() var_dump($ interval)。

So in the code below $interval->i is initially !isset() but isset() after I var_dump($interval).

$future = new DateTime("2018-08-24"); $now = new DateTime(); $interval = $future->diff($now); if (isset($interval->i)) { echo 'isset' . $interval->i; } else { echo 'not isset' . $interval->i; } var_dump($interval); if (isset($interval->i)) { echo 'isset' . $interval->i; } else { echo 'not isset' . $interval->i; }

可能是什么原因导致它们最初是!isset并且为空,但是isset

What could possibly be causing these to be !isset and empty initially, but isset and !empty afterwards?

推荐答案

不确定是否要使用哪个版本的PHP,但要使用PHP 7.0.5。它是一个错误。

Am not sure which version of PHP you are using but Use PHP version 7.0.5. Its a bug.

这应该很有用: bugs.php/bug.php?id=69587

更多推荐

PHP DateTime DateInterval isset在var

本文发布于:2023-11-07 23:08:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1567688.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:DateTime   PHP   DateInterval   var   isset

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!