3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(new Datetime('now -2 days +1 weekday'));
Output for 8.3.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.007064" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
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(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.010223" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.3.4
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.008566" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.3.3
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.006937" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.3.2
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.005082" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.3.1
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003963" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.3.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003847" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.2.18
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.010231" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.2.17
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.008615" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.2.16
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.008293" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.2.15
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.004016" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.2.14
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003900" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.2.13
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003897" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.2.12
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.004015" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.2.11
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.004057" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.2.10
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.006216" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.2.9
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003855" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.2.8
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003824" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.2.7
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003839" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.2.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003787" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.2.5
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003834" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.2.4
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.004289" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.2.3
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003517" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.2.2
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.005142" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.2.1
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003775" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.2.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.004212" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.28
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.009465" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.27
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003698" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.26
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003594" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.25
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003667" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.24
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.004174" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.23
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.005141" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.22
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003836" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.21
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003746" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.20
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.004047" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.19
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003860" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.18
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003740" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.17
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003582" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.16
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003573" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.15
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003615" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.14
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003961" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.13
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003389" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.12
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003791" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.11
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003545" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.10
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003714" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.9
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003486" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.8
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.004085" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.7
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003392" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003695" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.5
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003692" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.4
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003851" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.3
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003950" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.2
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003923" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.1
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003576" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003911" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.0.30
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003367" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.0.29
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.004197" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.0.28
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003328" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.0.27
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003593" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.0.26
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003100" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.0.25
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003196" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.0.24
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003785" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.0.23
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003973" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.0.22
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003382" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.0.21
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003482" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.0.20
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003109" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.0.19
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003369" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.0.18
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003520" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.0.17
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003697" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.0.16
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003254" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.0.15
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003269" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.0.14
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.005032" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.0.13
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 16:54:45.002143" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 8.0.12
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003658" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.0.11
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003727" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.0.10
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 17:54:45.003647" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.14 - 5.5.38, 5.6.0 - 5.6.38, 7.0.0 - 7.0.31, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33, 8.0.0 - 8.0.9
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.3.32 - 7.3.33
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-02 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.5.0 - 5.5.13
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-12-02 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }

preferences:
262.19 ms | 401 KiB | 316 Q