All the variables you have used have held only a single value.
An array is a special variable, which can hold more than one value at a time.
There are three types of array.
- Indexed Array : An array with a numeric index.
- Associative Array : Arrays with named keys.
- Nesting Array(Multi-D array) : An array containing one or more array.
How to define array
1.Indexed Arrays:- There are two ways to create of indexed array.
$cars = array(“VOLVO”,”TATA”,”BMW”);
$car’s = “VOLVO”;
$car’s = “TATA”;
$car’s = “BMW”;
- GET the length of an array – The count() function.
- The count() function is used to return the length (the number of elements) of an array.
2. Associative Arrays:-
- Associative arrays are arrays that use name keys that you assign to them.
- there are two ways to create an associative arrays.
$age = array(“peter”=>”35″,”Ben”=>”37”);
3. Multidimensional Arrays:-
- A multidimensional Arrays is an array containing one or more arrays.