3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php //$tz = new DateTimeZone('Europe/Amsterdam'); foreach (DateTimeZone::listIdentifiers() as $tz) { $now = new DateTime('2015-10-01', $tz); $then = new DateTime('2015-01-01', $tz); $diff = $now->diff($then); echo sprintf("Expected: %d. Returned: %d\n", 9, $diff->format('%m')); $now = new DateTime('2015-09-01', $tz); $then = new DateTime('2015-01-01', $tz); $diff = $now->diff($then); echo sprintf("Expected: %d. Returned: %d\n", 8, $diff->format('%m')); $now = new DateTime('2015-11-01', $tz); $then = new DateTime('2015-01-01', $tz); $diff = $now->diff($then); echo sprintf("Expected: %d. Returned: %d\n", 10, $diff->format('%m')); }
based on 897k4
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: DateTime::__construct() expects parameter 2 to be DateTimeZone, string given in /in/AjUIH:7 Stack trace: #0 /in/AjUIH(7): DateTime->__construct('2015-10-01', 'Africa/Abidjan') #1 {main} thrown in /in/AjUIH on line 7
Process exited with code 255.
Output for 5.3.18 - 5.6.28
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() expects parameter 2 to be DateTimeZone, string given' in /in/AjUIH:7 Stack trace: #0 /in/AjUIH(7): DateTime->__construct('2015-10-01', 'Africa/Abidjan') #1 {main} thrown in /in/AjUIH on line 7
Process exited with code 255.