<?php $begin = 11; $finish = 3; $period = new DatePeriod( DateTime::createFromFormat('m', $begin), new DateInterval('P1M'), DateTime::createFromFormat('m', $finish + ($begin > $finish ? 13 : 1)) // add 13 or 1 for inclusive range ); foreach ($period as $obj) { $array[] = $obj->format('n'); } var_export($array);
You have javascript disabled. You will not be able to edit any code.