hey @Weltkind first of all I suggest you read " http://php.net/manual/en/language.types.array.php ",
will now come to your answer. In php, the array key can be a string or an integer, and if you do not specify a key, then a default integer is specified, and the value of the next array key depends on the previous element of the integer key
next array key = previous integer key + 1;
In a PHP array, the same key value will be overridden by the same key
Now let's deal with your array2:
<?php $array2 = array("1"=>'Doctor','Boss', 2=>'Lynx', 'Lentin', 'Endless');
1) when you started your array with the "1" key so that
therefore, for the 1st key value [1] => "Doctor"
current array like: array ([1] => 'Doctor')
now the next key = previous integer key (i.e. 1) + 1 = 2;
2) for the second key value [2] => 'BOSS'
current array like: array ([1] => 'Doctor', [2] => 'BOSS')
3) next key = previous integer key (that is 2) + 1 = 3 it will transfer to the next key, but the next key is [2] => "Lynx", as you mentioned key [2] the value will be overridden by the value "BOSS "on" Lynx "; current array like: array ([1] => 'Doctor', [2] => 'Lynx')
Now we have the next key [3]
4) for the next value, the key [3] => 'Lentin'
current array like: array ([1] => "Doctor", [2] => "Lynx", [3] => 'Lentin');
now next key = previous integer key (i.e. 3) + 1 = 4;
5) for the next value, the key [4] => "Infinite"
current array like: array ([1] => "Doctor", [2] => "Lynx", [3] => "Lentin", [4] => "Infinite");
and so the last array looks like this:
array( [1] => 'Doctor', [2] => 'Lynx', [3] => 'Lentin', [4] => 'Endless' );