- round: documentation ( source)
- floor: documentation ( source)
- date: documentation ( source)
- strtotime: documentation ( source)
<?php
$strtDate = '2015-05-01';
$endDate = '2015-08-31';
$startDateWeekCnt = floor( date('d',strtotime($strtDate)) / 7) ;
// echo $startDateWeekCnt ."\n";
$endDateWeekCnt = floor( date('d',strtotime($endDate)) / 7) ;
//echo $endDateWeekCnt. "\n";
$datediff = strtotime(date('Y-m',strtotime($endDate))."-01") - strtotime(date('Y-m',strtotime($strtDate))."-01");
$totalnoOfWeek = round(floor($datediff/(60*60*24)) / 7) + $endDateWeekCnt - $startDateWeekCnt ;
echo $totalnoOfWeek ."\n";