Arrays

A PHP array stores several values. It can be indexed (numeric keys starting at 0) or associative (text keys). Both use the [] syntax. This versatile type serves as a list, a dictionary or a stack.

Example

$fruits = ['pomme', 'poire'];
$user = ['nom' => 'Léa', 'age' => 30];

Related concepts

The whole glossary