PHP Array Function

What is array Function?


The "array" function is used to create an array. The elements of array is ordered map which associates values to keys


array(key => value)

In the above syntax each array elements is created with a key and value. If the key is skipped the function will automatically assign a numerical key starting from "0".

Example :

Result :

Array ( 1 => Cherry 2 => Apple )

In the above example an array "$b" is created with keys "1" ,"2" and values "Cherry", "Apple".

PHP Topics

Ask Questions

Ask Question