3v4l.org

run code in 300+ PHP versions simultaneously
<?php $datetime1 = new DateTime('20150915'); $datetime2 = new DateTime("now"); $interval = $datetime1->diff($datetime2); print_r($interval,$datetime2);
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.6
Fatal error: Uncaught TypeError: print_r(): Argument #2 ($return) must be of type bool, DateTime given in /in/AG1Ze:6 Stack trace: #0 /in/AG1Ze(6): print_r(Object(DateInterval), Object(DateTime)) #1 {main} thrown in /in/AG1Ze on line 6
Process exited with code 255.
Output for 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
Warning: print_r() expects parameter 2 to be bool, object given in /in/AG1Ze on line 6
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0 - 7.2.33
Warning: print_r() expects parameter 2 to be boolean, object given in /in/AG1Ze on line 6

preferences:
152.84 ms | 403 KiB | 181 Q