array
array array([mixed variable], [mixed ...])
variable | Variable to place into an array element |
... | Further elements |
Creates an array from provided values or key => value pairs.
Returns:
Array formed of the values or key/value pairs given as arguments
Description:
array() is a language construct used to create an array with zero or more elements. Each argument passed to the function is used as a single element for the array.
By default, the construct creates a numerically indexed array such as $array[0]. The indices start at 0 and increase by one for every element in the array. For example, this would create an array with five elements:
$list = array ('alpha', 'zappa', 'bravo', 4, 2);
The first element (‘alpha’) would be stored at key ...
Get PHP Functions Essential Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.