|It is very easy to create a new array using the PHP array( ) function. A PHP array is a special type of variable that stores and organizes data. What makes an array variable special is that it can store more than one value; in fact, you can store as many values in one array as you need. But how can this array keep all those values organized? It uses index positions assigned to each value. You can think of an array as a stack of library books. The name of the array variable would be $books and the index positions (, , ) would be the unique number given to each book in the library and the title of the books would be the values in the array. Notice in the example below that the index positions begin with a zero and not with a one.|
It is very easy to create a new array and populate that array with more than one value or element by using the PHP array( ) function. As you can see below, the name of the array variable is followed by an equal sign and then the function name. On the right of the function name are the values in the array placed between parentheses. Each value is separated by a comma and enclosed within quotation marks. The whole thing ends with a semicolon.