Small function in PHP

Source: Internet
Author: User
The PHPArray function pos () is the alias of the current () function. It returns the current element of the array. The next () function moves the pointer to the current element to the next element and returns the current element. The natsort () function uses natural sequence algorithms to sort the elements in a given array. The natcasesort () function is case-insensitive.

The pos () function of the PHP Array function is the alias of the current () function. It returns the current element of the array. The next () function moves the pointer to the current element to the next element and returns the current element. The natsort () function uses natural sequence algorithms to sort the elements in a given array. The natcasesort () function is case-insensitive.

PHP Array Functions
The pos () function is the alias of the current () function. It returns the value of the current element in the array.
The next () function moves the pointer to the current element to the next element and returns the value of the current element.
The natsort () function uses natural sequence algorithms to sort the elements in a given array.
The natcasesort () function uses a case-insensitive natural sequence algorithm to sort the elements in a given array.
The list () function assigns values to a group of variables with elements in the array.
The ksort () function sorts the array by key name and retains the original key for the array value.
The krsort () function sorts the array by key in reverse order to reserve the original key for the array value.
The key () function returns the key name of the element currently pointed to by the pointer inside the array.
The in_array () function searches for the given value in the array.
Extract () function

PHP Array Functions
The end () function points the internal pointer of the array to the last element and returns the value (if successful) of the element ).
The each () function generates an array consisting of the key and key values of the elements pointed to by the current internal pointer of the array, and moves the internal Pointer Forward.
The current () function returns the current element (unit) in the array ).
The count () function calculates the number of units in the array or the number of attributes in the object.
The compact () function creates an array composed of parameters and variables. If an array exists in the parameter, the value of the variable in the array is also obtained.
The asort () function sorts arrays and maintains the index relationship. It is mainly used to sort the arrays that are very important to the unit order.
The arsort () function sorts arrays in reverse order and maintains the index relationship. It is mainly used to sort the arrays that are very important to the unit order.
Array_walk_recursive () cursive () function

PHP Array Functions
The array_walk () function applies a callback function to each element in the array. If the call succeeds, TRUE is returned. Otherwise, FALSE is returned.
The array_values () function returns an array containing all the key values in the given array without retaining the key name.
The array_unshift () function inserts one or more elements at the beginning of the array.
The array_unique () function removes repeated values from the array and returns the result array.
The array_uintersect_assoc () function carries the index check to calculate the intersection of arrays and compares data with the callback function.
The array_uintersect () function computes the intersection of arrays and compares the data with the callback function.
The array_udiff_uassoc () function returns a part that exists in the array1 array but does not exist in other arrays. The key names of the returned array remain unchanged.
The array_udiff_assoc () function returns the part that exists in array1 but does not exist in other arrays.
The array_udiff () function returns an array that contains all values in the compared array but not in any other parameter array. The key name remains unchanged.
The array_sum () function returns the sum of all values in the array.
The array_splice () function is similar to the array_slice () function. It selects a series of elements in the array but does not return them. Instead, it deletes them and replaces them with other values.
The array_slice () function extracts a value from the Array Based on the Conditions and returns it.
The array_shift () function deletes the first element in the array and returns the value of the deleted element.
The array_search () function is the same as the in_array () function. You can find a key value in the array. If this value is found, the key name of the matching element is returned. If not found, false is returned.
The array_reverse () function switches the elements in the original array sequentially, creates a new array, and returns the result. If the second parameter is set to true, the key name of the element remains unchanged; otherwise, the key name is lost.
The array_reduce () function iterates the array into a single value using the callback function. If the third parameter is specified, the parameter is treated as the first value in the array, or if the array is empty, it is used as the final return value.
The array_rand () function randomly selects one or more elements from the array and returns them.
The array_push () function adds one or more elements (in the stack) to the end of the array of the first parameter, and returns the length of the new array.
The array_product () function calculates and returns the product of all values in the array.
The array_pop () function deletes the last element in the array.
The array_pad () function inserts a specified number of elements with a specified value into an array.
The array_multisort () function sorts multiple arrays or multi-dimensional arrays.
The array_merge_recursive () function, like the array_merge () function, combines the elements of one or more arrays. The values of an array are appended to the values of the previous array. Returns an array of results.
The array_merge () function combines two or more numbers into an array.
The array_map () function returns the array after the User-Defined Function is applied. The number of parameters accepted by the callback function should be the same as the number of arrays passed to the array_map () function.
The array_keys () function returns a new array containing all the key names in the array.
The array_key_exists () function checks whether a specified key exists in an array. If the key exists, true is returned; otherwise, false is returned.
The array_intersect_ukey () function uses the callback function to compare key names to calculate the intersection of arrays.
The array_intersect_uassoc () function uses a custom callback function to calculate the intersection of arrays and compares indexes with callback functions.
The array_intersect_key () function uses the key name to compare and calculate the intersection of arrays.
The array_intersect_assoc () function returns the intersection array of two or more arrays.
The array_intersect () function returns the intersection array of two or more arrays.
The array_flip () function returns an inverted array. If the same value appears multiple times, the last key will be used as its value, and all other key names will be lost.
The array_filter () function uses the callback function to filter elements in the array. If the custom filter function returns true, the current value of the operated array is included in the returned result array, and form a new array of results. If the original array is an associated array, the key name remains unchanged.
The array_fill () function fills the array with the given value. The returned array has number elements and the value is value. The returned array uses a digital index, starting from the start position and increasing progressively. If the number is 0 or less than 0, an error occurs.
Array_diff_ukey () returns an array containing all the key names that appear in the array of array1 but are not displayed in any other parameter. Note that the link remains unchanged. Unlike array_diff (), the comparison is based on the key name rather than the value.
The array_diff_uassoc () function uses the custom callback function (callback) for index check to calculate the difference set of two or more arrays. Returns an array that contains values in array1 but not in any other parameter array.
The array_diff_key () function returns an array containing all the keys in the compared array but not in any other parameter array.
The array_diff_assoc () function returns the number of difference sets of two arrays. This array includes all keys and values in the compared array, but not in any other parameter array.
The array_diff () function returns the number of difference sets of two arrays. This array includes all the key values in the compared array, but not in any other parameter array.
The array_count_values () function is used to count the number of occurrences of all values in the array.
The array_combine () function combines two arrays to create a new array. One of the arrays is the key name, and the other is the key value.
The array_chunk () function splits an array into new array blocks.
The array_change_key_case () function converts all keys in the array to uppercase or lowercase letters.
Array () creates an array with keys and values. If the key is omitted in the specified array, an integer key is generated. The key starts from 0 and increments with 1.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.