3v4l.org

run code in 200+ PHP versions simultaneously
<?php date_default_timezone_set('Europe/Prague'); $t1 = \DateTime::createFromFormat('Y-m-d H:i:s', '2017-08-30 17:05:29'); $t2 = \DateTime::createFromFormat('Y-m-d H:i:s', '2017-11-30 16:50:59'); $i = $t2->diff($t1); echo "DIFF: {$i->m}mon {$i->d}day {$i->h}hrs {$i->i}min {$i->s}sec";
Output for 5.4.24 - 5.4.45, 5.5.8 - 7.3.1
DIFF: 3mon 0day -1hrs 45min 30sec
Output for 5.3.0 - 5.4.23, 5.5.0 - 5.5.7
DIFF: 2mon 30day 23hrs 45min 30sec
Output for 5.2.10 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/S7rGP on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/S7rGP on line 5 Fatal error: Call to undefined method DateTime::createFromFormat() in /in/S7rGP on line 4
Process exited with code 255.
Output for 5.2.0 - 5.2.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/S7rGP on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/S7rGP on line 5 Fatal error: Call to undefined method DateTime::createfromformat() in /in/S7rGP on line 4
Process exited with code 255.
Output for 5.1.0 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/S7rGP on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/S7rGP on line 5 Fatal error: Class 'DateTime' not found in /in/S7rGP on line 4
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/S7rGP on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/S7rGP on line 5 Fatal error: Call to undefined function date_default_timezone_set() in /in/S7rGP on line 3
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/S7rGP on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/S7rGP on line 5 Fatal error: Call to undefined function: date_default_timezone_set() in /in/S7rGP on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/S7rGP on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/S7rGP on line 5 Fatal error: Call to undefined function: date_default_timezone_set() in /in/S7rGP on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/S7rGP on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/S7rGP on line 5 Fatal error: Call to undefined function: date_default_timezone_set() in /in/S7rGP on line 3