3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $dt = new DateTimeImmutable('-2 hours'); $newDt = $dt->modify('+2 hours'); var_dump($dt->format('U')); var_dump($newDt->format('U')); var_dump($dt === $newDt);
Output for 5.5.0 - 5.6.38, hhvm-3.10.1 - 3.13.2, hhvm-3.17.3 - 3.22.0, 7.0.0 - 7.2.12
string(10) "1404552124" string(10) "1404559324" bool(false)
Output for hhvm-3.15.4
string(10) "1404552125" string(10) "1404559325" bool(false)
Output for 5.0.0 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/CQM2Y on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetimeimmutable in /in/CQM2Y on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetimeimmutable in /in/CQM2Y on line 3