I’m trying to retrieve the month using date.
$year= 2012;
$mon = date( 'F', mktime(0, 0, 0, $month,$year) );
In the above code snippet, $month is dynamically incremented. I have used a while loop with $month++. But it doesn’t give me the correct date.
For example, let’s say I gave $month=5 at the beginning, then it’s incremented till $month=12. Then the output should be something like
May
June
July...
but, it’s output is:
November
December
January.....
why is this? Am I doing anything wrong here?
You forgot $date parameter. THe correct syntax of mktime is
so in your example $year will be considered as ‘date’
try something like