PHP Array Functions
Order by
40 terms
Terms | Definitions |
|---|---|
array list ( mixed $varname [, mixed $... ] ) | Read array elements into variables, respectively.list($a, $b, $c) = array($a, $b, $c); |
array range ( mixed $start , mixed $limit [, number $step = 1 ] ) | Create an array containing a range of elements. |
int array_unshift ( array &$array , mixed $var [, mixed $... ] ) | Prepend one or more elements to the beginning of an array. |
mixed array_shift ( array &$array ) | Shift an element off the beginning of array. |
mixed array_pop ( array &$array ) | Pop the element off the end of array. |
mixed array_search ( mixed $needle , array $haystack [, bool $strict = false ] ) | Searches the array for a given value and returns the corresponding key if successful. |
bool array_key_exists ( mixed $key , array $search ) | Checks if the given key or index exists in the array. |
array array_values ( array $input ) | Returns all the values from an array and indexes the new array numerically. |
array array_keys ( array $input [, mixed $search_value [, bool $strict = false ]] ) | Return all the keys or a subset of the keys of an array. If search parameter is provided, only keys matching the value will be returned. |
mixed key ( array &$array ) | Returns the index element of the current array position. |
mixed current ( array &$array ) | Return the current element in an array. |
array each ( array &$array ) | Return the current key and value pair from an array and advance the array cursor. |
mixed prev ( array &$array ) | Returns the array value residing at the location preceding the current pointer location, or false if already at the first position. |
mixed end ( array &$array ) | Set the internal pointer of an array to its last element. Return last element. |
bool array_walk ( array &$array , callback $funcname [, mixed $userdata ] ) | Apply a user function to every member of an array. |
array array_count_values ( array $input ) | Counts all the values of an array. |
array array_reverse ( array $array [, bool $preserve_keys = false ] ) | Return an array with elements in reverse order. |
array array_flip ( array $trans ) | Exchanges all keys with their associated values in an array. |
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. |
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. |
bool rsort ( array &$array [, int $sort_flags = SORT_REGULAR ] ) | This function sorts an array in reverse order (highest to lowest). |
bool arsort ( array &$array [, int $sort_flags = SORT_REGULAR ] ) | Sort an array in reverse order and maintain index association. |
bool natsort ( array &$array ) | Sort an array using a "natural order" algorithm. i.e. photo1.jpg, photo2.jpg, photo10.jpg, photo20.jpg... |
bool natcasesort ( array &$array ) | Sort an array using a case insensitive "natural order" algorithm. i.e. photo1.jpg, PHOTO2.jpg, photo10.jpg, PHOTO20.jpg... |
bool ksort ( array &$array [, int $sort_flags = SORT_REGULAR ] ) | Sort an array by key. |
bool krsort ( array &$array [, int $sort_flags = SORT_REGULAR ] ) | Sort an array by key in reverse order. |
bool usort ( array &$array , callback $cmp_function ) | Sort an array by values using a user-defined comparison function. |
array array_merge ( array $array1 [, array $... ] ) | Merge one or more arrays. |
array array_merge_recursive ( array $array1 [, array $... ] ) | Merge two or more arrays recursively. Where keys match, merge values into new array indexed by matching key. |
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. |
array array_slice ( array $array , int $offset [, int $length [, bool $preserve_keys = false ]] ) | Returns the sequence of elements from the array array as specified by the offset and length parameters. |
array array_splice ( array &$input , int $offset [, int $length = 0 [, mixed $replacement ]] ) | Remove a portion of the array and replace it with something else. |
array array_intersect ( array $array1 , array $array2 [, array $ ... ] ) | returns an array containing all the values of array1 that are present in all the arguments. Note that keys are preserved. |
array array_intersect_assoc ( array $array1 , array $array2 [, array $ ... ] ) | 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(). |
array array_diff ( array $array1 , array $array2 [, array $... ] ) | Compares array1 against array2, arrayN and returns the difference. |
array array_diff_assoc ( array $array1 , array $array2 [, array $... ] ) | Compares array1 against array2 and returns the difference. Array keys are used in the comparison. |
mixed array_rand ( array $input [, int $num_req = 1 ] ) | Pick one or more random entries out of an array. |
bool shuffle ( array &$array ) | This function shuffles (randomizes the order of the elements in) an array. |
number array_sum ( array $array ) | Calculate the sum of values in an array. |
array array_chunk ( array $input , int $size [, bool $preserve_keys = false ] ) | Chunks an array into size large chunks. The last chunk may contain less than size elements. |
First Time Here?
Welcome to Quizlet, a fun, free place to study. Try these flashcards, find others to study, or make your own.