3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php //$writer = new XMLWriter(); echo var_dump(getdate(strtotime("-2 month"))); echo date("Y-m-t", strtotime("first day of previous month") ) ;
based on nULFI
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(11) { ["seconds"]=> int(10) ["minutes"]=> int(31) ["hours"]=> int(18) ["mday"]=> int(31) ["wday"]=> int(0) ["mon"]=> int(8) ["year"]=> int(2014) ["yday"]=> int(242) ["weekday"]=> string(6) "Sunday" ["month"]=> string(6) "August" [0]=> int(1409502670) } 2014-09-30
Output for 4.3.0 - 4.4.9, 5.0.3 - 5.2.17
array(11) { ["seconds"]=> int(10) ["minutes"]=> int(31) ["hours"]=> int(18) ["mday"]=> int(31) ["wday"]=> int(0) ["mon"]=> int(8) ["year"]=> int(2014) ["yday"]=> int(242) ["weekday"]=> string(6) "Sunday" ["month"]=> string(6) "August" [0]=> int(1409502670) } 1970-01-31
Output for 5.0.0 - 5.0.2
array(11) { ["seconds"]=> int(0) ["minutes"]=> int(0) ["hours"]=> int(0) ["mday"]=> int(31) ["wday"]=> int(0) ["mon"]=> int(8) ["year"]=> int(2014) ["yday"]=> int(242) ["weekday"]=> string(6) "Sunday" ["month"]=> string(6) "August" [0]=> int(1409436000) } 1970-01-31