3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Fatal error: Uncaught TypeError: DateTime::setTimestamp(): Argument #1 ($timestamp) must be of type int, string given in /in/HsNJB:5 Stack trace: #0 /in/HsNJB(5): DateTime->setTimestamp('2016-01-11 12:2...') #1 {main} thrown in /in/HsNJB on line 5
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Uncaught TypeError: DateTime::setTimestamp(): Argument #1 ($timestamp) must be of type int, string given in /in/HsNJB:5 Stack trace: #0 /in/HsNJB(5): DateTime->setTimestamp('2016-01-11 12:2...') #1 {main} thrown in /in/HsNJB on line 5
Process exited with code 255.
Output for 7.4.0 - 7.4.33
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 Fatal error: Uncaught Error: Object of class DateInterval could not be converted to string in /in/HsNJB:15 Stack trace: #0 {main} thrown in /in/HsNJB on line 15
Process exited with code 255.
Output for 7.3.32 - 7.3.33
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 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31
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.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 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.

preferences:
192.52 ms | 402 KiB | 229 Q