Created
October 25, 2017 15:24
-
-
Save ademalp/149d53a23b3e407351bf39aaf78c76fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//return[0] sunday/pazar | |
function dayCount($start,$end){ | |
$time = strtotime($start); | |
$end = strtotime($end); | |
$days = array(); | |
$day = date("w",$time); | |
isset($days[$day])?$days[$day]++ :$days[$day]=1; | |
while($time < $end){ | |
$time = strtotime("+1 day",$time); | |
$day = date("w",$time); | |
isset($days[$day])?$days[$day]++ :$days[$day]=1; | |
} | |
ksort($days); | |
return $days; | |
} | |
var_export(dayCount("2017-11-01","2017-11-30")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array ( | |
0 => 4, | |
1 => 4, | |
2 => 4, | |
3 => 5, | |
4 => 5, | |
5 => 4, | |
6 => 4, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment