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().
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;
}
What could possibly be causing these to be !isset and empty initially, but isset and !empty afterwards?