Operation of the PHP array

Source: Internet
Author: User

1. Merging arrays

Array Array_merge (array array1 array2...,arrayn)  ;

2. Recovering an array

When a key in an input array is already in the result array, the function takes a different approach. Array_merge () overrides the previously existing key/value pair, replacing it with the key/value pair in the current input array, and array_merge_recursive () merges two values together to form a new array with the original key as the array name. There is also the form of an array merge, which is a recursive append array. The form is:

Array array_merge_recursive (array Array1,array array2[...,array Arrayn])

3. Connect an array

Two arrays make up key-value pairs

Array Array_combine (array keys,array values)

  

4. Splitting the score group

When the length is negative, the array is taken from the offset start to the value of the countdown length.

Array array_slice (array array, int offset[,int length])

  

5. Joining an array

Deletes all elements in the array from offset to end of Offset+length and returns the deleted element as an array.

Array array_splice (array array, int Offset[,length[,array replacement])

  

6. The handover of the array

Value-oriented handover

Array array_intersect (array Array1,array array2[,arrayn ...])

  

7. Handover of associative arrays

Same as above, while increasing the handover of keys

Operation of the PHP array

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.