Introduction to some functions of PHP operation array _php tips

Source: Internet
Author: User
Searches for a specific value in the array and returns False if it finds return true
Boolean In_array (mixed Needle,array Haystack[,boolean Strict])

Finds a specified health in the array and returns False if found return True
Boolean array_eky_exists (mixed Key,array array)

Searches for a specific value in the array and returns False if it finds return true
Boolean array_search (mixed Needle,array Haystack[,boolean Strict])

Gets a new array of all the keys of an array
Array Array_keys (array array[,mixed search_value])

Gets a new array of all the values of an array
Array array_values (array array)

Determining the size of an array
Integer count (array array[,int mode])

Integer sizeof (array array[,int mode])

Statistical array element Occurrence frequency
Array array_count_values (array array)

Deletes a duplicate value in an array, returning an array of unique values
Array array_unique (array array)

Inverse array element order, Preserve_key the array key value order is unchanged if true
Array array_reverse (array Array[,boolean Preserve_key])

Permutation array keys and values
Array array_flip (array array)

Array ordering, sort_flags parameter optional, default behavior
Sort_numberic, sorted numerically, useful for sorting integers or floating-point numbers

Sort_regular, sorted by ASCII value

Sort_string, sorted in the correct order by proximity to the person's knowledge

Asort function key value order unchanged

void sort (array array[,int sort_flags])

void Asort (array array[,int sort_flags])

Array reverse order, sort_flags parameter optional, default behavior
Sort_numberic, sorted numerically, useful for sorting integers or floating-point numbers

Sort_regular, sorted by ASCII value

Sort_string, sorted in the correct order by proximity to the person's knowledge

Arsort function key value order unchanged

void Rsort (array array[,int sort_flags])

void Arsort (array array[,int sort_flags])

Array Natural Sort
void Natsort (array array)

Natural sorting without case sensitivity
void Natcasesort (array array)

Sort the array of key values
Boolean ksort (array array[,int sort_flags])

Key value Array reverse order
Boolean krsort (array array[,int sort_flags])

Sort by user Custom order
void Usort (array array,callback function_name)

Merges the arrays together to return an array of unions. Array_merge behind the front, array_merge_recursive merge together
Array Array_merge (array Array1[array array2 ...]) More than one

Array array_merge_recursive (array Array1,array array2[,array ...]) More than two

Keys and values to form a new array
Array array_combine (array Key,array value)

Returns part of the array, starting at offset and ending at offse+length position
Array array_slice (array array, int offset [, int length])

Deletes all elements from offset beginning to end of Offset+length and returns deleted elements as an array
Array Array_splice (array, int offset [, int length[,array peplacement]])

To find the intersection of the array, the key value is the key value in the first array
Array array_intersect (array Array1,array array2[,arrayn ...])

The intersection of the array contains the same key value and the key value is the key value in the first array
Array Array_intersect_assoc (array Array1,array array2[,arrayn ...])

To find the difference set of an array, the value of the first array that is not in the other array
Array Array_diff (array Array1,array array2[,arrayn ...])

To find the difference set of the array, the first array of values that are not in the other array contains the same key values
Array Array_diffassoc (array Array1,array array2[,arrayn ...])

Returns one or more key values in an array
Mixed Array_rand (array array[,int num_entries])

Shuffle functions
void Shuffle (array input_array)

Sum the values in the array
Mixed array_sum (array array);

Decomposes an array into a multidimensional array that contains the size element
Array array_chunk (array array, int size [, Boolean Preserve_keys])

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.