PHP Functions - PHP Array Functions PHP Array Introduction...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
PHP Array Functions PHP Array Introduction The array functions allow you to manipulate arrays. PHP supports both simple and multi-dimensional arrays. There are also specific functions for populating arrays from database queries. Installation The array functions are part of the PHP core. There is no installation needed to use these functions. PHP Array Functions PHP : indicates the earliest version of PHP that supports the function. Function Description PHP array() Creates an array 3 array_change_key_case() Returns an array with all keys in lowercase or uppercase 4 array_chunk() Splits an array into chunks of arrays 4 array_combine() Creates an array by using one array for keys and another for its values 5 array_count_values() Returns an array with the number of occurrences for each value 4 array_diff() Compares array values, and returns the differences 4 array_diff_assoc() Compares array keys and values, and returns the differences 4 array_diff_key() Compares array keys, and returns the differences 5 array_diff_uassoc() Compares array keys and values, with an additional user-made function check, and returns the differences 5 array_diff_ukey() Compares array keys, with an additional user-made function check, and returns the differences 5 array_fill() Fills an array with values 4 array_filter() Filters elements of an array using a user-made function 4 array_flip() Exchanges all keys with their associated values in an array 4 array_intersect() Compares array values, and returns the matches 4 array_intersect_assoc() Compares array keys and values, and returns the matches 4 array_intersect_key() Compares array keys, and returns the matches 5 array_intersect_uassoc() Compares array keys and values, with an additional user-made function check, and returns the matches 5
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
array_intersect_ukey() Compares array keys, with an additional user-made function check, and returns the matches 5 array_key_exists() Checks if the specified key exists in the array 4 array_keys() Returns all the keys of an array 4 array_map() Sends each value of an array to a user-made function, which returns new values 4 array_merge() Merges one or more arrays into one array 4 array_merge_recursive() Merges one or more arrays into one array 4 array_multisort() Sorts multiple or multi-dimensional arrays 4 array_pad() Inserts a specified number of items, with a specified value, to an array 4 array_pop() Deletes the last element of an array 4 array_product() Calculates the product of the values in an array 5 array_push() Inserts one or more elements to the end of an array 4 array_rand() Returns one or more random keys from an array 4 array_reduce() Returns an array as a string, using a user-defined function 4 array_reverse() Returns an array in the reverse order 4 array_search() Searches an array for a given value and returns the key 4 array_shift() Removes the first element from an array, and returns the value of the removed element 4 array_slice() Returns selected parts of an array 4 array_splice() Removes and replaces specified elements of an array 4 array_sum()
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 34

PHP Functions - PHP Array Functions PHP Array Introduction...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online