PHP Key of the First Array Element
Since programming uses zero-based numbering,
the key of the first array element
is 0. See the example:
<?php
$arr = ['a', 'b', 'c'];
echo $arr[0];
?>
Code execution result:
1
To output the first element of an array, use the
function array_shift.
See the example:
<?php
$arr = ['a', 'b', 'c'];
echo array_shift($arr);
?>
Code execution result:
'a'