3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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");
Output for 5.1.0 - 7.1.0
2
Output for 4.3.0 - 5.0.5
3