Following is an associative array I am using in a chunk of PHP code that creates an organized table of performance dates and information using data from a SQL database. The code appears to have no problems (to me), but is not behaving correctly when the webpage loads (certain dates are not appearing).
$months = array(
01 => 'January',
02 => 'February',
03 => 'March',
04 => 'April',
05 => 'May',
06 => 'June',
07 => 'July',
08 => 'August',
09 => 'September',
10 => 'October',
11 => 'November',
12 => 'December',
);
When I run a 'var_dump', the output is as follows:
array(11) {
[1]=> string(7) "January"
[2]=> string(8) "February"
[3]=> string(5) "March"
[4]=> string(5) "April"
[5]=> string(3) "May"
[6]=> string(4) "June"
[7]=> string(4) "July"
[0]=> string(9) "September"
[10]=> string(7) "October"
[11]=> string(8) "November"
[12]=> string(8) "December" }
The whole line for 'August' is missing, and the key for 'September' is now [0].
Can anybody explain where the error is in my code?
Disclaimer: I have solved the issue by removing the leading zeroes from the first nine keys, but I am confused as to why it mattered?? Thanks in advance for any explanation.