I need to understand through the PHP official documentation if in this case:
$vett[]=8.0;
$vett[]=6.5;
the internal index is increased automatically (to point to the next free location) soon after the end of the first statement or at the beginning of the second statement.
The confusion arises from the book of Robert Nixon:
First of all, internal array pointer means something absolutely different. It's a thing related to some outdated method for iterating over existing arrays (which is almost never used nowadays).
What you are talking about could be called "internal index", but there is no such thing in PHP.
The index is just set automatically at the beginning of each statement.
The PHP manual explains it pretty straightforward:
if no key is specified, the maximum of the existing int indices is taken, and the new key will be that maximum value plus 1 (but at least 0). If no int indices exist yet, the key will be 0 (zero).
So,
$vett[]=8.0;
, if $vett doesn't exist or doesn't have numerical indices yet, the key is set to 0, so its the same as doing $vett[0]=8.0;
$vett[]=6.5;
, PHP gets the maximum numeric key (which is 0), adds 1 and then the key is set 1, so its the same as doing $vett[1]=8.0;
everything is done right on the assignment, there is no "internal index" to be kept. Just a maximum index from the array. Check this code:
$vett = [];
$vett[60]=8.0;
$vett[]=6.5;
var_dump($vett);
It's as simple as max index+1
right on the assignment.