I have created a loop which will display date 2004 to 2014 in a formatted way. But the problem is, it is showing 204 instead of 2004 and continue this till 209.. So, how to show
Use str_pad:
echo $x.' Jan 20'.str_pad($yr, 2, '0', STR_PAD_LEFT).'';
Is more appropriate to use the function cal_days_in_month of the variable $x:
'; } } $yr++; } ?>