PHP Manual
Prev |  | Next

# array

array -- Create an array

## Description

`array array`(...);

Returns an array of the parameters. The parameters can be given an index with the `=>` operator.

> Note: array() is a language construct used to represent literal arrays, and not a regular function.

The following example demonstrates how to create a two-dimensional array, how to specify keys for associative arrays, and how to skip-and-continue numeric indices in normal arrays.

Example 1. array() example

      1
      2 $fruits = array (
      3     "fruits"  => array("a"=>"orange", "b"=>"banana", "c"=>"apple"),
      4     "numbers" => array(1, 2, 3, 4, 5, 6),
      5     "holes"   => array("first", 5 => "second", "third")
      6 );
      7

See also: list().

Prev | Home | Next
Array functions | Up | array_count_values