3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function getExpirationDate($months) { $date=strftime('%c'); //Get the current date $date=strtotime($date); $date = strtotime("+$months months", $date); //Add x number of months to the date $date = strtotime("+7 days", $date); //Add 7 days just to be sure $expired=date('Y-m-d H:i:s',$date); return $expired; } print_r(getExpirationDate(1)); ?>
Output for 4.3.3 - 4.4.9, 5.0.3 - 7.1.0
2014-05-12 17:44:47
Output for 5.0.0 - 5.0.2
2014-05-12 00:00:00
Output for 4.3.0 - 4.3.2
1970-02-08 00:59:59