3v4l.org

run code in 300+ PHP versions simultaneously
<?php $month = 2; $year = 2017; $week = date("W", strtotime($year . "-" . $month ."-01")); Echo date("d/m/Y", strtotime($year . "-" . $month ."-01")) ." - "; $unix = strtotime($year."W".$week ."+1 week"); While(date("m", $unix) == $month){ Echo date("d/m/Y", $unix-86400) . "\n"; Echo date("d/m/Y", $unix) ." - "; $unix = $unix + (86400*7); } Echo date("d/m/Y", strtotime("last day of ".$year . "-" . $month));
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.27, 8.4.1 - 8.4.14
01/02/2017 - 05/02/2017 06/02/2017 - 12/02/2017 13/02/2017 - 19/02/2017 20/02/2017 - 26/02/2017 27/02/2017 - 28/02/2017

preferences:
136.77 ms | 408 KiB | 5 Q