3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $lastDate = '01-11-2016'; $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 " "; echo $lastJob->diff($currentJob); echo " "; echo $lastJob->add($interval);
based on H1ZiM
Output for 7.1.0 - 7.2.0
Notice: A non well formed numeric value encountered in /in/I0VTn on line 5 Last Sent: 1970/01/01 Interval: 0 years, 0 months, 1 days Notice: Undefined variable: currentJob in /in/I0VTn on line 14 Warning: DateTime::diff() expects parameter 1 to be DateTimeInterface, null given in /in/I0VTn on line 14 Recoverable fatal error: Object of class DateTime could not be converted to string in /in/I0VTn on line 17
Process exited with code 255.
Output for 5.5.24 - 7.0.20
Notice: A non well formed numeric value encountered in /in/I0VTn on line 5 Last Sent: 1970/01/01 Interval: 0 years, 0 months, 1 days Notice: Undefined variable: currentJob in /in/I0VTn on line 14 Warning: DateTime::diff() expects parameter 1 to be DateTimeInterface, null given in /in/I0VTn on line 14 Catchable fatal error: Object of class DateTime could not be converted to string in /in/I0VTn on line 17
Process exited with code 255.
Output for 5.3.21 - 5.4.45
Notice: A non well formed numeric value encountered in /in/I0VTn on line 5 Last Sent: 1970/01/01 Interval: 0 years, 0 months, 1 days Notice: Undefined variable: currentJob in /in/I0VTn on line 14 Warning: DateTime::diff() expects parameter 1 to be DateTime, null given in /in/I0VTn on line 14 Catchable fatal error: Object of class DateTime could not be converted to string in /in/I0VTn on line 17
Process exited with code 255.