3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $d = new \DateTime('previous month'); $from = clone $d; $to = clone $d; $from->modify('first day of this month midnight'); $to->modify('last day of this month 23:59:59.999999'); var_dump($from); var_dump($to);
Output for 7.1.0 - 7.2.9
object(DateTime)#2 (3) { ["date"]=> string(26) "2017-06-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2017-06-30 23:59:59.999999" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.30, hhvm-3.15.4 - 3.22.0, 7.0.0 - 7.0.31
object(DateTime)#2 (3) { ["date"]=> string(26) "2017-06-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2017-06-30 23:59:59.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }