Arrays

suggest change

Introduction

An array is a data structure that stores an arbitrary number of values in a single value. An array in PHP is an ordered map: it associates values with keys.

Syntax

Parameters

Parameter Detail
Key The key identifies an element. It is an int or a string. Valid keys include 'foo', 10, and 'a2b'. A numeric string such as '5' is cast to the integer 5.
Value Each key has a corresponding value. The value may be any type. Reading a key that is not set returns null and emits a warning (a notice before PHP 8).

Remarks

See also

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents