3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date = new DateTimeImmutable (); $resultmonth1 = $date->format("n"); $date = $date->modify("next month"); $resultmonth2 = $date->format("n"); var_dump($resultmonth1,$resultmonth2); ?>