Es sind im Grunde nichtmal wirkliche Arrays (Felder), sondern meines Erachtens eher ein Konzept wie Hashmaps, auch assoziative Arrays genannt.
Ich kann doch auch Arrays mit numerischen Indizes erzeugen, wo ist das Problem?
$foo = ['bar','baz'];
Kannst du machen, trotzdem ist es kein "richtiges" Feld (Array), wie man es zum Beispiel aus C kennt.
"An array in PHP is actually an ordered map. A map is a type that associates values to keys. This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more. As array values can be other arrays, trees and multidimensional arrays are also possible. "
<http://php.net/manual/de/language.types.array.php>
Gibst du keinen Key an, wird implizit der nächstmögliche numerische Index genommen:
~~~php
$test = array(
"apfel",
1 => "birne",
"zitrone",
3 => "beere",
);
print_r($test);
$test = array(
"apfel",
1 => "birne",
"zitrone",
2 => "beere",
);
print_r($test);