3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $today = getdate(); $last2Months = getdate(strtotime("2 months ago", $today[0])); var_dump($last2Months); $nextMonth = getdate(strtotime("+1 month",$last2Months[0])); var_dump($nextMonth);
Output for 5.6.28, 7.0.14 - 7.1.0
array(11) { ["seconds"]=> int(32) ["minutes"]=> int(25) ["hours"]=> int(8) ["mday"]=> int(10) ["wday"]=> int(3) ["mon"]=> int(4) ["year"]=> int(2013) ["yday"]=> int(99) ["weekday"]=> string(9) "Wednesday" ["month"]=> string(5) "April" [0]=> int(1365575132) } array(11) { ["seconds"]=> int(32) ["minutes"]=> int(25) ["hours"]=> int(8) ["mday"]=> int(10) ["wday"]=> int(5) ["mon"]=> int(5) ["year"]=> int(2013) ["yday"]=> int(129) ["weekday"]=> string(6) "Friday" ["month"]=> string(3) "May" [0]=> int(1368167132) }
Output for 5.1.0 - 5.6.22, 7.0.0 - 7.0.7
array(11) { ["seconds"]=> int(32) ["minutes"]=> int(25) ["hours"]=> int(10) ["mday"]=> int(10) ["wday"]=> int(3) ["mon"]=> int(4) ["year"]=> int(2013) ["yday"]=> int(99) ["weekday"]=> string(9) "Wednesday" ["month"]=> string(5) "April" [0]=> int(1365582332) } array(11) { ["seconds"]=> int(32) ["minutes"]=> int(25) ["hours"]=> int(10) ["mday"]=> int(10) ["wday"]=> int(5) ["mon"]=> int(5) ["year"]=> int(2013) ["yday"]=> int(129) ["weekday"]=> string(6) "Friday" ["month"]=> string(3) "May" [0]=> int(1368174332) }
Output for 4.3.0 - 4.4.9, 5.0.3 - 5.0.5
array(11) { ["seconds"]=> int(32) ["minutes"]=> int(25) ["hours"]=> int(10) ["mday"]=> int(10) ["wday"]=> int(1) ["mon"]=> int(6) ["year"]=> int(2013) ["yday"]=> int(160) ["weekday"]=> string(6) "Monday" ["month"]=> string(4) "June" [0]=> int(1365582332) } array(11) { ["seconds"]=> int(32) ["minutes"]=> int(25) ["hours"]=> int(10) ["mday"]=> int(10) ["wday"]=> int(1) ["mon"]=> int(6) ["year"]=> int(2013) ["yday"]=> int(160) ["weekday"]=> string(6) "Monday" ["month"]=> string(4) "June" [0]=> int(1368174332) }
Output for 5.0.0 - 5.0.2
array(11) { ["seconds"]=> int(32) ["minutes"]=> int(25) ["hours"]=> int(10) ["mday"]=> int(10) ["wday"]=> int(1) ["mon"]=> int(6) ["year"]=> int(2013) ["yday"]=> int(160) ["weekday"]=> string(6) "Monday" ["month"]=> string(4) "June" [0]=> int(1365544800) } array(11) { ["seconds"]=> int(32) ["minutes"]=> int(25) ["hours"]=> int(10) ["mday"]=> int(10) ["wday"]=> int(1) ["mon"]=> int(6) ["year"]=> int(2013) ["yday"]=> int(160) ["weekday"]=> string(6) "Monday" ["month"]=> string(4) "June" [0]=> int(1368136800) }