In carrying out a script in PHP on many occasions there are variables that have similar information and will be processed in a similar way. This PHP (and other languages) have an element named array. An array is a set of variables grouped under a single name. Each variable within the matrix is called element. Within the same parent may exist variables of different types and is not necessary that all of the same type.
We must differentiate between two types of existing parent:
— Index: those whose access to the elements is done by their position within the structure (always start from the position 0). Example: $ friends 
— Partners: It is one in which elements are formed by key-value pairs and access are providing a certain key. Example: $ friends [ ‘age’]
To create arrays in PHP there are two ways:
— Implicitly, that would indicate the item (either by providing their position or key). Example: $ names  = ‘Javier’;
If not indicate a position the array take the following value to the final value introducido.Ejemplo: $ names  = ‘Lucas’ / / take as value 1 since the latest was introduced 0.
— By array () in which we pass the elements as parameters. If parent indexed taken the position they occupy in the creation of the matrix, while those of the parent association is assigned its value by “=>”. Example: $ friend = array ( ‘Name’ => ‘Jose’ , ‘Address’ =>’ Neopatria 21 ‘);
It is noteworthy that PHP is not only limited to the existence of parent alone but there are arrays of arrays, or what is the same, multidimensional arrays. Example: $ friends  [ ‘Pedro’]
Itinerary of a parent
There are various tools in order to access the elements of a matrix. Each time maintaining a reference element of the matrix to which it has access, therefore, go to a matrix simply modify such reference. If a parent indexed the tour be conducted through a loop and for this we must know the total number of elements which owns the matrix. This is the basis of the function count (variable) where variable is the variable you want to get the number of elements. If variable is a parent returns the number of elements which have, returns 1 if only one element (though not a parent) and 0 if no value.
Another function that lets us know the number of items is sizeof (womb).
To access the elements of an associative array must use the ecah () to recover the pair formed by key and value addition and moving a position of pointer. His syntax is each (womb) and the values that returns the parent association are as follows:
0 Name of the key
1 associative value of the key
Key Name of the key
Value value associated with the key
The role of the builder list (variable1, variable2 … variables) is to assign values of current element of a matrix of variables listed as a parameter.
Navigation on parent
When it comes to parent Indexed navigation is simple because it just enough access to the item you want to show, but in the case of any parent association can not apply the same treatment. To this end there are a set of prefabricated functions that allow us to make many actions:
reset (parent); The internal pointer back to the top
end (parent); The internal pointer goes to the last position
next (parent); Pointer goes to the next item
prev (parent); Go to the front
current (parent); Returns content of the current element
For the insertion of elements within an array there are a number of functions that allow us to add items. These include:
array_push (parent variable1, variable);
Add elements at the end of the function and increase its length as many items have been added
array_unshift (parent variable1, variable);
Add the principle elements of the role displacing many other positions as there are elements.
array_pad (parent nuevo_tamaño, valor_relleno);
It increases the size of the matrix using a value provided as filler.
Elimination of elements
Remove the first element of the matrix
It eliminates the last element of the matrix
array_splice (entry, pos_ini, [size], [substitutes]);
It is used to replace or erase the contents of a portion of matrix, for it must specify the position from which we start erasing or replacement, size or number of elements that will be affected and substitutes (if we want to replace it with some element).
array_keys (parent [value sought]);
It is used when we want to remove an element whose position unknown.
Returns an array indexed with all values stored in the matrix passed as a parameter.
Bulk Handling parent
array_walk (parent nombre_de_la_funcion, lista_parametros);
Used to perform the same process defined in the role in all elements included.
array_slice (parent, position, size);
Lets draw a sequence of elements of a matrix. The parameters are to pass the matrix in which we draw these elements, the position from which begins extraction and size of the collection (covering positions from the original).
Order ascending (matrix indexed) sort (womb)
Descending Order (matrix indexed) rsort (womb)
Order by ascending value (associative array) asort (womb)
Descending Order worth (associative array) arsort (womb)
Order by ascending key (associative array) ksort (womb)
Order by descending key (associative array) krsort (womb)
This section would comment on a number of functions (not all would be impossible because) we can at some point.
compact () Returns an array of associations from an unspecified number of parameters
extract () Creates variables from parent associations
array_unique () Returns parent without repeated because some data are removed
array_reverse () Returns matrix with same elements but in reverse order
shuffle () Amendment to the order of items at random
array_count_values () Returns an associative array containing frequency of repetition of the values of the matrix
in_array () allows you to check if a value in this matrix
array_merge () combines elements of two arrays at 1.