3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $date = new DateTimeImmutable (); $resultmonth1 = $date->format("n"); $date = $date->modify("next month"); $resultmonth2 = $date->format("n"); var_dump($resultmonth1,$resultmonth2); ?>
Output for 5.6.28, 7.0.12 - 7.1.0
string(1) "8" string(1) "9"
Output for 5.5.35 - 5.6.7, 5.6.21, 7.0.6
string(1) "5" string(1) "6"
Output for 5.5.24 - 5.5.29, 5.5.34, 5.6.8 - 5.6.14, 5.6.20, 7.0.5
string(1) "4" string(1) "5"
Output for 5.5.31 - 5.5.33, 5.6.15 - 5.6.19, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.0.4
string(1) "3" string(1) "4"
Output for 5.5.30
string(1) "3" string(1) "5"
Output for 5.0.0 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/Rqccc 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/Rqccc 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/Rqccc on line 3