PHP Arrays

An array stores multiple values in one single variable:


What is an Array?


An array is a special variable, which can hold more than one value at a time.

An Array is a Special Variable which can store more than one value in Single Variable

In PHP, the array() function is used to create an array:

Syntax

array();

An array can hold many values under a single name, and you can access the values by referring to an index number.


In PHP, there are three types of arrays:
  • Indexed arrays[Numeric Array/one Dimantional/Simple Array] - Arrays with a numeric index
  • Associative arrays - Arrays with named keys
  • Multidimensional arrays - Arrays containing one or more arrays

Differance between Variable & Array

Variable: We Can Store single value or data or information
Array: We Can Store more than one value or data or information