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 of $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 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Wednesday, 2014-01-01 Wednesday, 2014-01-08 Wednesday, 2014-01-15 Wednesday, 2014-01-22 Wednesday, 2014-01-29
Output for 4.3.0 - 5.0.5, 5.1.3 - 5.2.17
Thursday, 1970-01-01
Output for 5.1.0 - 5.1.2

Process exited with code 137.