3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getSundays($y, $m) { return new DatePeriod( new DateTime("first Sunday of $y-$m"), DateInterval::createFromDateString('next sunday'), new DateTime("last day of $y-$m") ); } $days=""; foreach (getSundays(2016, 04) as $Sunday) { $days[] = $Sunday->format("d"); } var_dump($days);

preferences:
52.81 ms | 404 KiB | 5 Q