ISN (services de réseaux sociaux internationaux - applications interactives et sites web dynamiques)
PHP Array - Tutoriels et source code gratuit
An array in PHP is actually an ordered map. A map is a type that associates values to keys. This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more. As array values can be other arrays, trees and multidimensional arrays are also possible.
Explanation of those data structures is beyond the scope of this manual, but at least one example is provided for each of them. For more information, look towards the considerable literature that exists about this broad topic.
Specifying with array()
array( key => value, key2 => value2, key3 => value3, ... )
The comma after the last array element is optional and can be omitted. This is usually done for single-line arrays, i.e. array(1, 2) is preferred over array(1, 2, ). For multi-line arrays on the other hand the trailing comma is commonly used, as it allows easier addition of new elements at the end.
As of PHP 5.4 you can also use the short array syntax, which replaces array() with .
Additionally the following key casts will occur:
If multiple elements in the array declaration use the same key, only the last one will be used as all others are overwritten.
The key is optional. If it is not specified, PHP will use the increment of the largest previously used integer key.