3v4l.org

run code in 300+ PHP versions simultaneously
<?php $locale = "de"; $intlTimezone = \IntlTimeZone::createDefault(); $dateTimezone = $intlTimezone->toDateTimeZone(); $calendar = new \IntlGregorianCalendar($intlTimezone, $locale); $dateFormatter = \IntlDateFormatter::create($locale, 2, -1, $intlTimezone, $calendar, "dd.MM.y"); $time = DateTimeImmutable::createFromFormat("Y-m-d", "978-12-27", $dateTimezone); var_dump($time); var_dump($time->format("d.m.Y")); var_dump($dateFormatter->format($time));
Output for 7.4.26 - 7.4.32, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.4, 8.3.6 - 8.3.7
object(DateTimeImmutable)#5 (3) { ["date"]=> string(26) "0978-12-27 13:31:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } string(10) "27.12.0978" string(9) "22.12.978"
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 object(DateTimeImmutable)#5 (3) { ["date"]=> string(26) "0978-12-27 13:31:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } string(10) "27.12.0978" string(9) "22.12.978"
Output for 8.0.13
Fatal error: Uncaught Error: Class "IntlTimeZone" not found in /in/tXVgn:4 Stack trace: #0 {main} thrown in /in/tXVgn on line 4
Process exited with code 255.
Output for 7.2.29 - 7.2.33, 7.3.16 - 7.3.31, 7.4.4 - 7.4.25, 8.0.0 - 8.0.12
object(DateTimeImmutable)#5 (3) { ["date"]=> string(26) "0978-12-27 14:31:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(10) "27.12.0978" string(9) "22.12.978"
Output for 7.3.32 - 7.3.33, 7.4.33
Fatal error: Uncaught Error: Class 'IntlTimeZone' not found in /in/tXVgn:4 Stack trace: #0 {main} thrown in /in/tXVgn on line 4
Process exited with code 255.
Output for 7.1.25, 7.2.0 - 7.2.13, 7.3.0, 7.4.0
object(DateTimeImmutable)#5 (3) { ["date"]=> string(26) "0978-12-27 14:31:03.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(3) "CET" } string(10) "27.12.0978" string(9) "22.12.978"
Output for 5.6.38, 7.0.33
object(DateTimeImmutable)#5 (3) { ["date"]=> string(26) "0978-12-27 14:31:03.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(3) "CET" } string(10) "27.12.0978" bool(false)

preferences:
140.61 ms | 402 KiB | 156 Q