Hello again,
In programming, arrays start at zero by default unless you specify the keys to be used. In your example, the programmer started at 1 and skipped zero. PHP will ignore all keys that haven’t been made but will still reference the value in the key that it was assigned. When I program my PHP scripts, I use names for my keys instead of numbers; I only use numbers when I have to. Basically when you don’t specify a key, it will default with numbers:
[php]$var[] = ‘red’; // $var[0]
$var[] = ‘orange’; // $var[1]
$var[] = ‘yellow’; // $var[2]
$var[] = ‘green’; // $var[3]
$var[] = ‘blue’; // $var[4][/php]
Now if you start with a number and use the techniques above, look what happens:
[php]$var[10] = ‘red’; // $var[10]
$var[] = ‘orange’; // $var[11]
$var[] = ‘yellow’; // $var[12]
$var[] = ‘green’; // $var[13]
$var[] = ‘blue’; // $var[14][/php]
The following link will further explain to you about PHP arrays: http://php.net/manual/en/language.types.array.php.
And to answer your last question: I don’t know why the programmer did what he/she did. Since you didn’t provide the entire code, I can’t tell you definitively. Please let me know if you need further assistance.
Cheers!