3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function getWednesdays($y, $m) { $ts = strtotime("first wednesday of $y-$m-01"); $end = strtotime("last wednesday $y-$m"); $wednesdays = array(); while($ts <= $end) { $wednesdays[] = $ts; $ts = strtotime('next wednesday', $ts); } return $wednesdays; } foreach (getWednesdays(2014, 1) as $wednesday) { echo date("l, Y-m-d\n", $wednesday); }
Output for 5.3.0 - 7.1.0