3v4l.org

run code in 300+ PHP versions simultaneously
<?php $firstActivationDate = new DateTime('2020-06-30T00:00:00'); $paymentWindow = (new DateTime())->modify('-2 months'); if ($paymentWindow < $firstActivationDate) { $paymentWindow = $firstActivationDate; } var_dump($paymentWindow);
Output for 7.2.0 - 7.2.31, 7.3.0 - 7.3.19, 7.4.0 - 7.4.7, 8.0.0alpha1 - alpha2
object(DateTime)#1 (3) { ["date"]=> string(26) "2020-06-30 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }