3v4l.org

run code in 500+ PHP versions simultaneously
<?php $time = '1985-04-19T19:12:11'; $timeOnly = DateTime::createFromFormat("Y-m-d\TH:i:s+", $time)->setDate(1970, 1, 1); $begin = (new DateTime('18:00'))->setDate(1970, 1, 1); $end = (new DateTime('22:00'))->setDate(1970, 1, 1); var_dump($timeOnly, $begin, $end, $timeOnly > $begin, $timeOnly < $end);
Output for 8.1.0 - 8.1.34, 8.2.10 - 8.2.30, 8.3.0 - 8.3.4, 8.3.6 - 8.3.30, 8.4.1 - 8.4.21, 8.5.0 - 8.5.7
object(DateTime)#1 (3) { ["date"]=> string(26) "1970-01-01 19:12:11.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "1970-01-01 18:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "1970-01-01 22:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(true) bool(true)
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) "1970-01-01 19:12:11.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "1970-01-01 18:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "1970-01-01 22:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(true) bool(true)

preferences:
50.37 ms | 918 KiB | 4 Q