how to count how many sundays in month?
Answer Posted / koushikgraj
function total_sundays($month,$year)
{
$sundays=0;
$total_days=cal_days_in_month(CAL_GREGORIAN, $month, $year);
for($i=1;$i<=$total_days;$i++)
if(date('N',strtotime($year.'-'.$month.'-'.$i))==7)
$sundays++;
return $sundays;
}
echo total_sundays(1,2011);
| Is This Answer Correct ? | 45 Yes | 9 No |
Post New Answer View All Answers
Do you know what is the function func_num_args() used for?
What is the difference between explode and split?
What is the name of the scripting engine that powers PHP?
Tell me how to initiate a session in php?
What are hooks in php?
How to run the interactive php shell from the command line interface?
What is a persistence cookie?
How to pad an array with the same value multiple times?
Explain about objects in PHP?
What is instantiation?
What is php trait?
Is rent a variable cost?
How we get browser details of clients machine?
my english is not too good then what we apply for a php programer post
what the new feature add in php 7.2?