3v4l.org

run code in 300+ PHP versions simultaneously
<?php function daysBetween($start_date, $end_date, $weekDay) { $first_date = strtotime($start_date." -1 days"); $first_date = strtotime(date("M d Y",$first_date)." next ".$weekDay); $last_date = strtotime($end_date." +1 days"); $last_date = strtotime(date("M d Y",$last_date)." last ".$weekDay); return floor(($last_date - $first_date)/(7*86400)) + 1; } print daysBetween("DEC 13 2005", "DEC 26 2005", "Monday");

preferences:
44.63 ms | 402 KiB | 5 Q