Account
Categories

Array


Array:

Defination

An array is a variable that stores one or more values.

Each value can be accessed using an index number, such as:

$numbers = array(10, 20, 30);
echo $numbers[0]; // Output: 10

Values can be accessed using index numbers such as 0, 1, and 2.

Note: An array can be indexed using numeric indices.

There are many types of arrays, which are listed below:

  • Indexed Array – uses numeric indexes (like 0, 1, 2..)
  • Associative Array – uses named keys (like "name", "age"...)
  • Multidimensional Array – contains one or more arrays inside another array.