3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $today = new \DateTime(); $lastManagerLogDate = (new \DateTime())->modify('-7 days'); $diff = $today->diff($validDate); var_dump($diff->d); exit;
based on MgI88
Output for 7.2.0 - 7.3.0rc3
Notice: Undefined variable: validDate in /in/bBQ1I on line 5 Warning: DateTime::diff() expects parameter 1 to be DateTimeInterface, null given in /in/bBQ1I on line 5 Notice: Trying to get property 'd' of non-object in /in/bBQ1I on line 7 NULL
Output for 5.6.30, 7.0.30 - 7.1.20
Notice: Undefined variable: validDate in /in/bBQ1I on line 5 Warning: DateTime::diff() expects parameter 1 to be DateTimeInterface, null given in /in/bBQ1I on line 5 Notice: Trying to get property of non-object in /in/bBQ1I on line 7 NULL
Output for hhvm-3.22.0
Notice: Undefined variable: validDate in /in/bBQ1I on line -1 Warning: DateTime::diff() expects parameter 1 to be DateTimeInterface, stdClass given in /in/bBQ1I on line -1 Notice: Cannot access property on non-object in /in/bBQ1I on line -1 NULL
Output for hhvm-3.18.5 - 3.21.3
Notice: Undefined variable: validDate in /in/bBQ1I on line 5 Warning: DateTime::diff() expects parameter 1 to be DateTimeInterface, stdClass given in /in/bBQ1I on line 5 Notice: Cannot access property on non-object in /in/bBQ1I on line 7 NULL