3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $lastDate = '2016-01-11 12:24:34'; $interval = 'P0Y0M1D'; $lastJob = new \Datetime(); $lastJob->setTimestamp($lastDate); echo ('Last Sent: '.$lastJob->format('Y/m/d')); echo " "; $interval = new DateInterval($interval); echo ('Interval: '.$interval->format('%y years, %m months, %d days')); echo " "; $currentJob = new \Datetime(); echo $lastJob->diff($currentJob); echo " "; echo $lastJob->add($interval);
based on bXolU
Output for 7.1.0 - 7.2.0
Notice: A non well formed numeric value encountered in /in/HsNJB on line 5 Last Sent: 1970/01/01 Interval: 0 years, 0 months, 1 days Recoverable fatal error: Object of class DateInterval could not be converted to string in /in/HsNJB on line 15
Process exited with code 255.
Output for 5.3.21 - 7.0.20
Notice: A non well formed numeric value encountered in /in/HsNJB on line 5 Last Sent: 1970/01/01 Interval: 0 years, 0 months, 1 days Catchable fatal error: Object of class DateInterval could not be converted to string in /in/HsNJB on line 15
Process exited with code 255.