Array

array is the array structure.

It may be written as array() or with square brackets [], which is also called the array short syntax.

The keys that serve as index in the array may be string or integers.

An array assigns automatically an integer index to the values appended to it. An arbitrary index may be assigned with the => syntax, or when accessing an element in the array.

Mixed keys in an array refers to the practice add elements in the array with both the automatic indexing and the arbitrary assignment.

<?php

$array = array(1, 2, 3);

$anotherArray = ['a' => 2, 'b' => 33];

echo $anotherArray['b']; // 33

?>

Documentation

See also New Array Functions in PHP 8.4, PHP arrays are driving me mad and PHP Oddities.

Related : Index For Arrays, Addition, Comma, Dereferencing, Cryptographic Hash, Hash, Hash, Iterable, List, Map, Sort, Sort, Indexed Array, Associative Array, ArrayObject, Collection, Multiplication, Recursive Array, Square Brackets, Array With Curly Braces, count(), Tree, Weakmap, file_put_contents(), iterator_to_array(), Offset, yield from Keyword, array_column, Autovivification, Data Structure, Pair, Pop, Dot Notation, PHP Natives, Self-reference, Serde, Bucket, Multidimensional Array, Nesting, RecursiveArrayIterator, Sequence, Set, Swap

Related packages : voku/arrayy