3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date1 = new DateTime(time()); $interval = new DateInterval('P1H5M'); $date2 = $date1->clone(); $date2->add($interval); $diff = $date2->diff($date1); echo $diff->format('%i') /*...*/; echo ($date2->getTimestamp() - $date1->getTimestamp()) / 60;
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.26, 7.3.0 - 7.3.13, 7.4.0 - 7.4.1
Fatal error: Uncaught Exception: DateInterval::__construct(): Unknown or bad format (P1H5M) in /in/Kvn3Q:4 Stack trace: #0 /in/Kvn3Q(4): DateInterval->__construct('P1H5M') #1 {main} thrown in /in/Kvn3Q on line 4
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Fatal error: Uncaught exception 'Exception' with message 'DateInterval::__construct(): Unknown or bad format (P1H5M)' in /in/Kvn3Q:4 Stack trace: #0 /in/Kvn3Q(4): DateInterval->__construct('P1H5M') #1 {main} thrown in /in/Kvn3Q on line 4
Process exited with code 255.

preferences:
171.49 ms | 402 KiB | 242 Q