3v4l.org

run code in 300+ PHP versions simultaneously
<?php print "System Timezone: ". date_default_timezone_get() ."\n\n"; $inputDate = "5/30/18"; $formatter = new IntlDateFormatter('en-US', IntlDateFormatter::SHORT, IntlDateFormatter::NONE, 'Europe/Berlin'); $timestamp = $formatter->parse($inputDate); print "Using date:\n"; print "Timestamp: {$timestamp}\n"; print "Formatted: ". date(\DateTime::ATOM ." e", $timestamp) ."\n"; print "MySQL: ". date("Y-m-d H:i:s", $timestamp) ."\n"; print "\n\nUsing DateTime(Immutable):\n"; $dt = \DateTimeImmutable::createFromFormat("!U", $timestamp); print "Formatted: ". $dt->format(\DateTime::ATOM ." e") ."\n"; print "MySQL: ". $dt->format("Y-m-d H:i:s") ."\n";
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.32, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
System Timezone: Europe/Amsterdam Using date: Timestamp: 1527631200 Formatted: 2018-05-30T00:00:00+02:00 Europe/Amsterdam MySQL: 2018-05-30 00:00:00 Using DateTime(Immutable): Formatted: 2018-05-29T22:00:00+00:00 +00:00 MySQL: 2018-05-29 22:00:00
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 System Timezone: Europe/Amsterdam Using date: Timestamp: 1527631200 Formatted: 2018-05-30T00:00:00+02:00 Europe/Amsterdam MySQL: 2018-05-30 00:00:00 Using DateTime(Immutable): Formatted: 2018-05-29T22:00:00+00:00 +00:00 MySQL: 2018-05-29 22:00:00
Output for 8.0.13
System Timezone: UTC Fatal error: Uncaught Error: Class "IntlDateFormatter" not found in /in/YTTLD:5 Stack trace: #0 {main} thrown in /in/YTTLD on line 5
Process exited with code 255.
Output for 7.4.33
System Timezone: Europe/Amsterdam Fatal error: Uncaught Error: Class 'IntlDateFormatter' not found in /in/YTTLD:5 Stack trace: #0 {main} thrown in /in/YTTLD on line 5
Process exited with code 255.
Output for 7.3.32 - 7.3.33
System Timezone: UTC Fatal error: Uncaught Error: Class 'IntlDateFormatter' not found in /in/YTTLD:5 Stack trace: #0 {main} thrown in /in/YTTLD on line 5
Process exited with code 255.

preferences:
235.7 ms | 401 KiB | 284 Q