66 of 110 menu

The First Array Element in PHP

The first element of an array has an index 0. To get it, you should access it by this index. See the example:

<?php $arr = ['a', 'b', 'c']; echo $arr[0]; ?>

Code execution result:

1

You can also use the array_shift function. See the example:

<?php $arr = ['a', 'b', 'c']; echo array_shift($arr); ?>

Code execution result:

'a'
English
БеларускаяEspañolРусский
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline