How to learn PHParray_diff_key_PHP tutorial-php Tutorial

Source: Internet
Author: User
How to learn PHParray_diff_key. How to learn PHParray_diff_key definition and usage the array_diff_key () function returns an array, which includes all the elements in the compared array but not in any other parameter array. how to learn PHP array_diff_key

Definition and usage

The array_diff_key () function returns an array containing all the keys in the compared array but not in any other parameter array.

Syntax

Array_diff_key (array1, array2, array3 ...)

Parameters

Description

Array1 is required. The first array to be compared with other arrays.

Array2 is required. The array to be compared with the first array.

Array3 is optional. The array to be compared with the first array. There can be multiple.

Tips and comments

Tip: one or more arrays can be compared with the first array.

Note: only the key name is used for comparison.

Example

"Cat", 1 => "Dog", 2 => "Horse"); $ a2 = array (2 => "Bird", 3 => "Rat ", 4 => "Fish"); $ a3 = array (5 => "Horse", 6 => "Dog", 7 => "Bird "); print_r (array_diff_key ($ a1, $ a2, $ a3);?>

Output:

Array ([0] => Cat [1] => Dog)

Array_diff_key definition and usage the array_diff_key () function returns an array that includes all the elements in the compared array but not in any other parameter 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.