3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tz = new \DateTimeZone('Europe/Moscow'); $dt = new DateTimeImmutable('now'); $dt->setTimezone($tz); $timestamp = (int) $dt->format('U'); $timestamp += 1000; $dt2 = \DateTimeImmutable::createFromFormat('U', $timestamp, $dt); var_dump($dt, $dt2);
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.4, 8.3.6
Fatal error: Uncaught TypeError: DateTimeImmutable::createFromFormat(): Argument #3 ($timezone) must be of type ?DateTimeZone, DateTimeImmutable given in /in/ZXs7g:9 Stack trace: #0 /in/ZXs7g(9): DateTimeImmutable::createFromFormat('U', '1446045078', Object(DateTimeImmutable)) #1 {main} thrown in /in/ZXs7g on line 9
Process exited with code 255.
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 Fatal error: Uncaught TypeError: DateTimeImmutable::createFromFormat(): Argument #3 ($timezone) must be of type ?DateTimeZone, DateTimeImmutable given in /in/ZXs7g:9 Stack trace: #0 /in/ZXs7g(9): DateTimeImmutable::createFromFormat('U', '1446045078', Object(DateTimeImmutable)) #1 {main} thrown in /in/ZXs7g on line 9
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught TypeError: Argument 3 passed to DateTimeImmutable::createFromFormat() must be an instance of DateTimeZone or null, instance of DateTimeImmutable given in /in/ZXs7g:9 Stack trace: #0 /in/ZXs7g(9): DateTimeImmutable::createFromFormat('U', 1446045078, Object(DateTimeImmutable)) #1 {main} thrown in /in/ZXs7g on line 9
Process exited with code 255.
Output for 7.1.33
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:54:38.000198" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.1.32
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:54:38.000150" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.1.31
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:54:38.000266" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.1.30
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:54:38.000248" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.1.29
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:54:38.000205" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.1.28
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:54:38.000168" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.1.27
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:54:38.000163" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.1.26
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:54:38.000159" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.1.20
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:54:38.001975" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.1.10
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:54:38.004313" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.1.7
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:54:38.002444" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.1.6
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:54:38.011288" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.1.5
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:54:38.011352" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.1.0
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:54:38.004104" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.6.28, 7.0.20
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:54:38.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.0.6
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-05-03 17:57:04.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.0.5
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-03 06:24:51.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.0.4
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-10 18:09:57.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.0.3
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-18 18:58:09.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.0.2
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-23 01:22:06.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.0.1
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-24 05:06:02.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.0.0
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-27 07:02:34.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.6.21
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-05-02 13:07:58.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.6.20
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-10 05:24:06.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.6.19
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-08 02:20:12.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.6.18
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-15 11:01:28.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.6.17
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-19 22:42:43.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.6.16
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-28 07:49:49.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.6.15
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-29 08:40:31.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.6.14
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-02 10:33:45.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.6.13
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-15 14:54:34.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.6.12
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-20 05:23:14.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.6.11
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-24 11:39:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.6.10
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-25 13:48:33.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.6.9
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-27 18:58:01.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.6.8
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-30 03:51:30.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.5.35
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-05-22 19:32:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.5.34
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-11 07:36:20.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.5.33
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-09 04:57:17.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.5.32
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-17 14:40:07.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.5.31
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-21 01:41:30.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.5.30
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-01 10:34:06.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.5.29
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-17 05:18:50.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.5.28
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-21 08:36:15.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.5.27
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-22 10:25:09.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.5.26
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-26 16:31:34.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.5.25
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-28 23:22:34.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.5.24
Warning: DateTimeImmutable::createFromFormat() expects parameter 3 to be DateTimeZone, object given in /in/ZXs7g on line 9 object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-05-24 05:57:20.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 5.4.0 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/ZXs7g on line 4
Process exited with code 255.

preferences:
228.84 ms | 401 KiB | 258 Q