PHP arrays PHP arrays introduction
Arrays are used for storing one or more values in a single variable name. Each element of an array has its own ID for easy access. Arrays can be of the following types:Numeric:
An array with numeric ID keyExample:
$names = array(“Mike”, “Perry”);Associative:
Above array can be interpreted as :- array= mike and array= perry
An array in which each ID key is associated with a value.Example:
$ages = array("mike"=>32, "perry"=>30);Multidimensional:
Having more than one arrayExample:
$families = array
Explain the purpose of $GLOBALS superglobal array with an example.
$GLOBAL array contains all the global variables used in the script. The variable names are the keys of the array.