how to count how many sundays in month?
Answer Posted / ashish kumar
/* $day = 0 for counting sunday. If you want to count
any other day in a month then set the $day accordingly.
For example $day = 3 for wednesday
*/
$day = 0;
$temp = date('j') - date('w') + $day ;
$count_day_in_a_month = (int)($temp/7) + (int)((date('t') -
$temp)/7) + 1;
Is This Answer Correct ? | 13 Yes | 10 No |
Post New Answer View All Answers
How is it possible to set an infinite execution time for php script?
What is the use of mysql_real_escape_string() function?
How would you determine the size of a file in php?
How to pass variables by references?
What is meant by variable variables in php?
How to get ip address of clients machine?
Write a program to swap two numbers using php.
What is an array in php?
Differences between get and post methods?
How do you end a session in php?
What are the two most common ways to start and finish a php block of code?
Why is php so popular?
Is php an api?
What are different types of Print Functions available in PHP?
Which methods should be used for sending an email using the variables $to, $subject, and $body?