3v4l.org

run code in 300+ PHP versions simultaneously
<?php $frmdate = "2015-06-05"; $todate = "2015-08-31"; for ($date = strtotime($frmdate); $date <= strtotime($todate); $date = strtotime("+1 day", $date)) { $custom_day = date("D", $date); $dte = date("Y-m-d", $date); if($custom_day == 'Sat') $custom_third_sat[] = date('Y-m-d', strtotime("third Saturday of $dte")); } echo "<pre>"; print_r(array_unique($custom_third_sat));
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
<pre>Array ( [0] => 2015-06-20 [4] => 2015-07-18 [8] => 2015-08-15 )

preferences:
186.36 ms | 404 KiB | 225 Q