array array_change_key_case ( array $array [, int $case = CASE_LOWER ] ) |
Returns an array with all keys from array lowercased or uppercased. Numbered indices are left as is. |
Returns an array with its keys lower or uppercased, or FALSE if array is not an array. |
array array_chunk ( array $array , int $size [, bool $preserve_keys = false ] ) |
Chunks an array into arrays with size elements. The last chunk may contain less than size elements. |
Returns a multidimensional numerically indexed array, starting with zero, with each dimension containing size elements. |
array array_column ( array $input , mixed $column_key [, mixed $index_key = null ] ) |
returns the values from a single column of the input, identified by the column_key. Optionally, an index_key may be provided to index the values in the returned array by the values from the index_key column of the input array. |
Returns an array of values representing a single column from the input array. |
array array_combine ( array $keys , array $values ) |
Creates an array by using the values from the keys array as keys and the values from the values array as the corresponding values. |
Returns the combined array, FALSE if the number of elements for each array isn't equal. |
array array_count_values ( array $array ) |
array_count_values() returns an array using the values of array as keys and their frequency in array as values. |
Returns an associative array of values from array as keys and their count as value. |
array array_diff_assoc ( array $array1 , array $array2 [, array $... ] ) |
Compares array1 against array2 and returns the difference. Unlike array_diff() the array keys are also used in the comparison. |
Returns an array containing all the values from array1 that are not present in any of the other arrays. |
array array_diff_key ( array $array1 , array $array2 [, array $... ] ) |
Compares the keys from array1 against the keys from array2 and returns the difference. This function is like array_diff() except the comparison is done on the keys instead of the values. |
Returns an array containing all the entries from array1 whose keys are not present in any of the other arrays. |
array array_diff_uassoc ( array $array1 , array $array2 [, array $... ], callable $key_compare_func ) |
Compares array1 against array2 and returns the difference. Unlike array_diff() the array keys are used in the comparison. Unlike array_diff_assoc() an user supplied callback function is used for the indices comparison, not internal function. |
Returns an array containing all the entries from array1 that are not present in any of the other arrays. |
array array_diff_ukey ( array $array1 , array $array2 [, array $... ], callable $key_compare_func ) |
Compares the keys from array1 against the keys from array2 and returns the difference. This function is like array_diff() except the comparison is done on the keys instead of the values. Unlike array_diff_key() a user supplied callback function is used for the indices comparison, not internal function. |
Returns an array containing all the entries from array1 that are not present in any of the other arrays. |
array array_diff ( array $array1 , array $array2 [, array $... ] ) |
Compares array1 against one or more other arrays and returns the values in array1 that are not present in any of the other arrays. |
Returns an array containing all the entries from array1 that are not present in any of the other arrays. |
array array_fill_keys ( array $keys , mixed $value ) |
Fills an array with the value of the value parameter, using the values of the keys array as keys. |
Returns the filled array |
array array_fill ( int $start_index , int $num , mixed $value ) |
Fills an array with num entries of the value of the value parameter, keys starting at the start_index parameter. |
Returns the filled array |
array array_filter ( array $array [, callable $callback [, int $flag = 0 ]] ) |
Iterates over each value in the array passing them to the callback function. If the callback function returns true, the current value from array is returned into the result array. Array keys are preserved. |
Returns the filtered array. |
array array_flip ( array $array ) |
array_flip() returns an array in flip order, i.e. keys from array become values and values from array become keys. Note that the values of array need to be valid keys, i.e. they need to be either integer or string. A warning will be emitted if a value has the wrong type, and the key/value pair in question will not be included in the result. If a value has several occurrences, the latest key will be used as its value, and all others will be lost. |
Returns the flipped array on success and NULL on failure. |
array array_intersect_assoc ( array $array1 , array $array2 [, array $... ] ) |
array_intersect_assoc() returns an array containing all the values of array1 that are present in all the arguments. Note that the keys are also used in the comparison unlike in array_intersect(). |
Returns an associative array containing all the values in array1 that are present in all of the arguments. |
array array_intersect_key ( array $array1 , array $array2 [, array $... ] ) |
array_intersect_key() returns an array containing all the entries of array1 which have keys that are present in all the arguments. |
Returns an associative array containing all the entries of array1 which have keys that are present in all arguments. |
array array_intersect_uassoc ( array $array1 , array $array2 [, array $... ], callable $key_compare_func ) |
array_intersect_uassoc() returns an array containing all the values of array1 that are present in all the arguments. Note that the keys are used in the comparison unlike in array_intersect(). |
Returns the values of array1 whose values exist in all of the arguments. |
array array_intersect_ukey ( array $array1 , array $array2 [, array $... ], callable $key_compare_func ) |
array_intersect_ukey() returns an array containing all the values of array1 which have matching keys that are present in all the arguments. |
Returns the values of array1 whose keys exist in all the arguments. |
array array_intersect ( array $array1 , array $array2 [, array $... ] ) |
array_intersect() returns an array containing all the values of array1 that are present in all the arguments. Note that keys are preserved. |
Returns an array containing all of the values in array1 whose values exist in all of the parameters. |
bool array_key_exists ( mixed $key , array $array ) |
array_key_exists() returns TRUE if the given key is set in the array. key can be any value possible for an array index. |
Returns TRUE on success or FALSE on failure. |
array array_keys ( array $array [, mixed $search_value = null [, bool $strict = false ]] ) |
array_keys() returns the keys, numeric and string, from the array. If the optional search_value is specified, then only the keys for that value are returned. Otherwise, all the keys from the array are returned. |
Returns an array of all the keys in array. |
array array_map ( callable $callback , array $array1 [, array $... ] ) |
array_map() returns an array containing all the elements of array1 after applying the callback function to each one. The number of parameters that the callback function accepts should match the number of arrays passed to the array_map() |
Returns an array containing all the elements of array1 after applying the callback function to each one. |
array array_merge_recursive ( array $array1 [, array $... ] ) |
array_merge_recursive() merges the elements of one or more arrays together so that the values of one are appended to the end of the previous one. It returns the resulting array. If the input arrays have the same string keys, then the values for these keys are merged together into an array, and this is done recursively, so that if one of the values is an array itself, the function will merge it with a corresponding entry in another array too. If, however, the arrays have the same numeric key, the later value will not overwrite the original value, but will be appended. |
An array of values resulted from merging the arguments together. |
array array_merge ( array $array1 [, array $... ] ) |
Merges the elements of one or more arrays together so that the values of one are appended to the end of the previous one. It returns the resulting array. If the input arrays have the same string keys, then the later value for that key will overwrite the previous one. If, however, the arrays contain numeric keys, the later value will not overwrite the original value, but will be appended. Values in the input array with numeric keys will be renumbered with incrementing keys starting from zero in the result array. |
Returns the resulting array. |
bool array_multisort ( array &$array1 [, mixed $array1_sort_order = SORT_ASC [, mixed $array1_sort_flags = SORT_REGULAR [, mixed $... ]]] ) |
array_multisort() can be used to sort several arrays at once, or a multi-dimensional array by one or more dimensions. Associative (string) keys will be maintained, but numeric keys will be re-indexed. |
Returns TRUE on success or FALSE on failure. |
array array_pad ( array $array , int $size , mixed $value ) |
array_pad() returns a copy of the array padded to size specified by size with value value. If size is positive then the array is padded on the right, if it's negative then on the left. If the absolute value of size is less than or equal to the length of the array then no padding takes place. It is possible to add at most 1048576 elements at a time. |
Returns a copy of the array padded to size specified by size with value value. If size is positive then the array is padded on the right, if it's negative then on the left. If the absolute value of size is less than or equal to the length of the array then no padding takes place. |
mixed array_pop ( array &$array ) |
array_pop() pops and returns the last value of the array, shortening the array by one element. Note: This function will reset() the array pointer of the input array after use. |
Returns the last value of array. If array is empty (or is not an array), NULL will be returned. |
number array_product ( array $array ) |
array_product() returns the product of values in an array. |
Returns the product as an integer or float. |
int array_push ( array &$array , mixed $value1 [, mixed $... ] ) |
array_push() treats array as a stack, and pushes the passed variables onto the end of array. The length of array increases by the number of variables pushed. Note: If you use array_push() to add one element to the array it's better to use $array[] = because in that way there is no overhead of calling a function. Note: array_push() will raise a warning if the first argument is not an array. This differs from the $var[] behaviour where a new array is created. |
Returns the new number of elements in the array. |
mixed array_rand ( array $array [, int $num = 1 ] ) |
Picks one or more random entries out of an array, and returns the key (or keys) of the random entries. It uses a pseudo random number generator that is not suitable for cryptographic purposes. |
When picking only one entry, array_rand() returns the key for a random entry. Otherwise, an array of keys for the random entries is returned. This is done so that random keys can be picked from the array as well as random values. Trying to pick more elements than there are in the array will result in an E_WARNING level error, and NULL will be returned. |
mixed array_reduce ( array $array , callable $callback [, mixed $initial = NULL ] ) |
array_reduce() applies iteratively the callback function to the elements of the array, so as to reduce the array to a single value. |
Returns the resulting value. If the array is empty and initial is not passed, array_reduce() returns NULL. |
array array_replace_recursive ( array $array1 , array $array2 [, array $... ] ) |
array_replace_recursive() replaces the values of array1 with the same values from all the following arrays. If a key from the first array exists in the second array, its value will be replaced by the value from the second array. If the key exists in the second array, and not the first, it will be created in the first array. If a key only exists in the first array, it will be left as is. If several arrays are passed for replacement, they will be processed in order, the later array overwriting the previous values. array_replace_recursive() is recursive : it will recurse into arrays and apply the same process to the inner value. When the value in array1 is scalar, it will be replaced by the value in array2, may it be scalar or array. When the value in array1 and array2 are both arrays, array_replace_recursive() will replace their respective value recursively. |
Returns an array, or NULL if an error occurs. |
array array_replace ( array $array1 , array $array2 [, array $... ] ) |
array_replace() replaces the values of array1 with values having the same keys in each of the following arrays. If a key from the first array exists in the second array, its value will be replaced by the value from the second array. If the key exists in the second array, and not the first, it will be created in the first array. If a key only exists in the first array, it will be left as is. If several arrays are passed for replacement, they will be processed in order, the later arrays overwriting the previous values. array_replace() is not recursive : it will replace values in the first array by whatever type is in the second array. |
Returns an array, or NULL if an error occurs. |
array array_reverse ( array $array [, bool $preserve_keys = false ] ) |
Takes an input array and returns a new array with the order of the elements reversed. |
Returns the reversed array. |
mixed array_search ( mixed $needle , array $haystack [, bool $strict = false ] ) |
Searches haystack for needle. |
Returns the key for needle if it is found in the array, FALSE otherwise. If needle is found in haystack more than once, the first matching key is returned. To return the keys for all matching values, use array_keys() with the optional search_value parameter instead. Warning This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function. |
mixed array_shift ( array &$array ) |
array_shift() shifts the first value of the array off and returns it, shortening the array by one element and moving everything down. All numerical array keys will be modified to start counting from zero while literal keys won't be touched. Note: This function will reset() the array pointer of the input array after use. |
Returns the shifted value, or NULL if array is empty or is not an array. |
array array_slice ( array $array , int $offset [, int $length = NULL [, bool $preserve_keys = false ]] ) |
array_slice() returns the sequence of elements from the array array as specified by the offset and length parameters. |
Returns the slice. If the offset is larger than the size of the array then returns an empty array. |
array array_splice ( array &$input , int $offset [, int $length = 0 [, mixed $replacement = array() ]] ) |
Removes the elements designated by offset and length from the input array, and replaces them with the elements of the replacement array, if supplied. Note that numeric keys in input are not preserved. Note: If replacement is not an array, it will be typecast to one (i.e. (array) $replacement). This may result in unexpected behavior when using an object or NULL replacement. |
Returns an array consisting of the extracted elements. |
number array_sum ( array $array ) |
array_sum() returns the sum of values in an array. |
Returns the sum of values as an integer or float. |
array array_udiff_assoc ( array $array1 , array $array2 [, array $... ], callable $value_compare_func ) |
Computes the difference of arrays with additional index check, compares data by a callback function. Note: Please note that this function only checks one dimension of a n-dimensional array. Of course you can check deeper dimensions by using, for example, array_udiff_assoc($array1[0], $array2[0], "some_comparison_func");. |
array_udiff_assoc() returns an array containing all the values from array1 that are not present in any of the other arguments. Note that the keys are used in the comparison unlike array_diff() and array_udiff(). The comparison of arrays' data is performed by using an user-supplied callback. In this aspect the behaviour is opposite to the behaviour of array_diff_assoc() which uses internal function for comparison. |
array array_udiff_uassoc ( array $array1 , array $array2 [, array $... ], callable $value_compare_func , callable $key_compare_func ) |
Computes the difference of arrays with additional index check, compares data and indexes by a callback function. Note that the keys are used in the comparison unlike array_diff() and array_udiff(). |
Returns an array containing all the values from array1 that are not present in any of the other arguments. |
array array_udiff ( array $array1 , array $array2 [, array $... ], callable $value_compare_func ) |
Computes the difference of arrays by using a callback function for data comparison. This is unlike array_diff() which uses an internal function for comparing the data. |
Returns an array containing all the values of array1 that are not present in any of the other arguments. |
array array_uintersect_assoc ( array $array1 , array $array2 [, array $... ], callable $value_compare_func ) |
Computes the intersection of arrays with additional index check, compares data by a callback function. Note that the keys are used in the comparison unlike in array_uintersect(). The data is compared by using a callback function. |
Returns an array containing all the values of array1 that are present in all the arguments. |
array array_uintersect_uassoc ( array $array1 , array $array2 [, array $... ], callable $value_compare_func , callable $key_compare_func ) |
Computes the intersection of arrays with additional index check, compares data and indexes by separate callback functions. |
Returns an array containing all the values of array1 that are present in all the arguments. |
array array_uintersect ( array $array1 , array $array2 [, array $... ], callable $value_compare_func ) |
Computes the intersection of arrays, compares data by a callback function. |
Returns an array containing all the values of array1 that are present in all the arguments. |
array array_unique ( array $array [, int $sort_flags = SORT_STRING ] ) |
Takes an input array and returns a new array without duplicate values. Note that keys are preserved. array_unique() sorts the values treated as string at first, then will keep the first key encountered for every value, and ignore all following keys. It does not mean that the key of the first related value from the unsorted array will be kept. Note: Two elements are considered equal if and only if (string) $elem1 === (string) $elem2 i.e. when the string representation is the same, the first element will be used. |
Returns the filtered array. |
int array_unshift ( array &$array , mixed $value1 [, mixed $... ] ) |
array_unshift() prepends passed elements to the front of the array. Note that the list of elements is prepended as a whole, so that the prepended elements stay in the same order. All numerical array keys will be modified to start counting from zero while literal keys won't be touched. |
Returns the new number of elements in the array. |
array array_values ( array $array ) |
array_values() returns all the values from the array and indexes the array numerically. |
Returns an indexed array of values. |
bool array_walk_recursive ( array &$array , callable $callback [, mixed $userdata = NULL ] ) |
Applies the user-defined callback function to each element of the array. This function will recurse into deeper arrays. |
Returns TRUE on success or FALSE on failure. |
bool array_walk ( array &$array , callable $callback [, mixed $userdata = NULL ] ) |
Applies the user-defined callback function to each element of the array array. array_walk() is not affected by the internal array pointer of array. array_walk() will walk through the entire array regardless of pointer position. |
Returns TRUE on success or FALSE on failure. If function callback requires more parameters than given to it, an error of level E_WARNING will be generated each time array_walk() calls callback. |
array array ([ mixed $... ] ) |
Creates an array. Read the section on the array type for more information on what an array is. |
Returns an array of the parameters. The parameters can be given an index with the => operator. Read the section on the array type for more information on what an array is. |
bool arsort ( array &$array [, int $sort_flags = SORT_REGULAR ] ) |
This function sorts an array such that array indices maintain their correlation with the array elements they are associated with. This is used mainly when sorting associative arrays where the actual element order is significant. Note: If two members compare as equal, their relative order in the sorted array is undefined. |
Returns TRUE on success or FALSE on failure. |
bool asort ( array &$array [, int $sort_flags = SORT_REGULAR ] ) |
This function sorts an array such that array indices maintain their correlation with the array elements they are associated with. This is used mainly when sorting associative arrays where the actual element order is significant. Note: If two members compare as equal, their relative order in the sorted array is undefined. |
Returns TRUE on success or FALSE on failure. |
array compact ( mixed $varname1 [, mixed $... ] ) |
Creates an array containing variables and their values. For each of these, compact() looks for a variable with that name in the current symbol table and adds it to the output array such that the variable name becomes the key and the contents of the variable become the value for that key. In short, it does the opposite of extract(). Any strings that are not set will simply be skipped. |
Returns the output array with all the variables added to it. |
int count ( mixed $array_or_countable [, int $mode = COUNT_NORMAL ] ) |
Counts all elements in an array, or something in an object. For objects, if you have SPL installed, you can hook into count() by implementing interface Countable. The interface has exactly one method, Countable::count(), which returns the return value for the count() function. Please see the Array section of the manual for a detailed explanation of how arrays are implemented and used in PHP. |
Returns the number of elements in array_or_countable. If the parameter is not an array or not an object with implemented Countable interface, 1 will be returned. There is one exception, if array_or_countable is NULL, 0 will be returned. Caution count() may return 0 for a variable that isn't set, but it may also return 0 for a variable that has been initialized with an empty array. Use isset() to test if a variable is set. |
mixed current ( array &$array ) |
Every array has an internal pointer to its "current" element, which is initialized to the first element inserted into the array. |
The current() function simply returns the value of the array element that's currently being pointed to by the internal pointer. It does not move the pointer in any way. If the internal pointer points beyond the end of the elements list or the array is empty, current() returns FALSE. Warning This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function. |
array each ( array &$array ) |
Return the current key and value pair from an array and advance the array cursor. After each() has executed, the array cursor will be left on the next element of the array, or past the last element if it hits the end of the array. You have to use reset() if you want to traverse the array again using each. |
Returns the current key and value pair from the array array. This pair is returned in a four-element array, with the keys 0, 1, key, and value. Elements 0 and key contain the key name of the array element, and 1 and value contain the data. If the internal pointer for the array points past the end of the array contents, each() returns FALSE. |
mixed end ( array &$array ) |
end() advances array's internal pointer to the last element, and returns its value. |
Returns the value of the last element or FALSE for empty array. |
int extract ( array &$array [, int $flags = EXTR_OVERWRITE [, string $prefix = NULL ]] ) |
Import variables from an array into the current symbol table. Checks each key to see whether it has a valid variable name. It also checks for collisions with existing variables in the symbol table. |
Returns the number of variables successfully imported into the symbol table. |
bool in_array ( mixed $needle , array $haystack [, bool $strict = FALSE ] ) |
Searches haystack for needle using loose comparison unless strict is set. |
Returns TRUE if needle is found in the array, FALSE otherwise. |
key_exists |
This function is an alias of: array_key_exists(). |
mixed key ( array &$array ) |
key() returns the index element of the current array position. |
The key() function simply returns the key of the array element that's currently being pointed to by the internal pointer. It does not move the pointer in any way. If the internal pointer points beyond the end of the elements list or the array is empty, key() returns NULL. |
bool krsort ( array &$array [, int $sort_flags = SORT_REGULAR ] ) |
Sorts an array by key in reverse order, maintaining key to data correlations. This is useful mainly for associative arrays. |
Returns TRUE on success or FALSE on failure. |
bool ksort ( array &$array [, int $sort_flags = SORT_REGULAR ] ) |
Sorts an array by key, maintaining key to data correlations. This is useful mainly for associative arrays. |
Returns TRUE on success or FALSE on failure. |
array list ( mixed $var1 [, mixed $... ] ) |
Like array(), this is not really a function, but a language construct. list() is used to assign a list of variables in one operation. Note: list() only works on numerical arrays and assumes the numerical indices start at 0. Warning In PHP 5, list() assigns the values starting with the right-most parameter. Warning Modification of the array during list() execution (e.g. using list($a, $b) = $b) results in undefined behavior. |
Returns the assigned array. |
bool natcasesort ( array &$array ) |
natcasesort() is a case insensitive version of natsort(). This function implements a sort algorithm that orders alphanumeric strings in the way a human being would while maintaining key/value associations. This is described as a "natural ordering". Note: If two members compare as equal, their relative order in the sorted array is undefined. |
Returns TRUE on success or FALSE on failure. |
bool natsort ( array &$array ) |
This function implements a sort algorithm that orders alphanumeric strings in the way a human being would while maintaining key/value associations. This is described as a "natural ordering". An example of the difference between this algorithm and the regular computer string sorting algorithms (used in sort()) can be seen in the example below. Note: If two members compare as equal, their relative order in the sorted array is undefined. |
Returns TRUE on success or FALSE on failure. |
mixed next ( array &$array ) |
next() behaves like current(), with one difference. It advances the internal array pointer one place forward before returning the element value. That means it returns the next array value and advances the internal array pointer by one. |
Returns the array value in the next place that's pointed to by the internal array pointer, or FALSE if there are no more elements. Warning This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function. |
pos |
This function is an alias of: current() |
mixed prev ( array &$array ) |
Rewind the internal array pointer. prev() behaves just like next(), except it rewinds the internal array pointer one place instead of advancing it. Note: You won't be able to distinguish the beginning of an array from a boolean FALSE element. To properly traverse an array which may contain FALSE elements, see the each() function. |
Returns the array value in the previous place that's pointed to by the internal array pointer, or FALSE if there are no more elements. Warning This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function. |
array range ( mixed $start , mixed $end [, number $step = 1 ] ) |
Create an array containing a range of elements. |
Returns an array of elements from start to end, inclusive. |
mixed reset ( array &$array ) |
reset() rewinds array's internal pointer to the first element and returns the value of the first array element. |
Returns the value of the first array element, or FALSE if the array is empty. |
bool rsort ( array &$array [, int $sort_flags = SORT_REGULAR ] ) |
This function sorts an array in reverse order (highest to lowest). Note: If two members compare as equal, their relative order in the sorted array is undefined. |
Returns TRUE on success or FALSE on failure. |
bool shuffle ( array &$array ) |
This function shuffles (randomizes the order of the elements in) an array. It uses a pseudo random number generator that is not suitable for cryptographic purposes. Note: If two members compare as equal, their relative order in the sorted array is undefined. Note: This function assigns new keys to the elements in array. It will remove any existing keys that may have been assigned, rather than just reordering the keys. |
Returns TRUE on success or FALSE on failure. |
sizeof |
This function is an alias of: count(). |
bool sort ( array &$array [, int $sort_flags = SORT_REGULAR ] ) |
This function sorts an array. Elements will be arranged from lowest to highest when this function has completed. Note: If two members compare as equal, their relative order in the sorted array is undefined. |
Returns TRUE on success or FALSE on failure. |
bool uasort ( array &$array , callable $value_compare_func ) |
This function sorts an array such that array indices maintain their correlation with the array elements they are associated with, using a user-defined comparison function. This is used mainly when sorting associative arrays where the actual element order is significant. Note: If two members compare as equal, their relative order in the sorted array is undefined. |
Returns TRUE on success or FALSE on failure. |
bool uksort ( array &$array , callable $key_compare_func ) |
uksort() will sort the keys of an array using a user-supplied comparison function. If the array you wish to sort needs to be sorted by some non-trivial criteria, you should use this function. Note: If two members compare as equal, their relative order in the sorted array is undefined. |
Returns TRUE on success or FALSE on failure. |
bool usort ( array &$array , callable $value_compare_func ) |
This function will sort an array by its values using a user-supplied comparison function. If the array you wish to sort needs to be sorted by some non-trivial criteria, you should use this function. Note: If two members compare as equal, their relative order in the sorted array is undefined. Note: This function assigns new keys to the elements in array. It will remove any existing keys that may have been assigned, rather than just reordering the keys. |
Returns TRUE on success or FALSE on failure. |