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
What are the uses of implode() function?
How long should a session last?
Which escape sequences can be used in single quoted strings in php?
What is a php 5?
What good is polymorphism?
Does php need html?
Explain Booleans in PHP?
How to split a string into array using php?
What is a lambda function in php?
What is overriding in php?
Is php still in demand?
Which parts of php are case sensitive?
Where is my php ini file?
What are the difference between array_keys() and array_key_exists() in php?
Is php 5.6 secure?