<?php $thirtyOnedayMonths = array( 1, 3, 5, 7, 8, 10, 12 ); $oneMonth = new \DateInterval('P1M'); $format = 'Y-m-d'; foreach($thirtyOnedayMonths as $month){ $date = new \DateTime("2013-{$month}-31 00:00:01"); var_dump($date->format($format)); $date->sub($oneMonth); var_dump($date->format($format)); }
You have javascript disabled. You will not be able to edit any code.