Detailed PHP implementation to find the two different elements in the array method

Source: Internet
Author: User
How does PHP find the different elements in two arrays? This article mainly introduces the PHP implementation of query Two array of different elements of the method, involving the PHP array difference set operation and array merging related techniques, the need for friends can refer to. We hope to help you.

<?php  $a = Array (  "Max_allow_dialogs",  "Livechat_server_ip",  "Livechat_service_time",  " ABORT_ZH_CN ",  " ABORT_ZH_TW ",  " Abort_en_usa ",  " WELCOME_ZH_CN ",  " WELCOME_ZH_TW ",  " welcome_en _usa ",  " TIMEOUT_ZH_CN ",  " TIMEOUT_ZH_TW ",  " Timeout_en_usa ",  " ABSENCE_ZH_CN ",  " Absence_ Zh_tw ",  " Absence_en_usa "  );  $b = Array (  "Max_allow_dialogs",  "Livechat_server_ip",  "Livechat_service_time",  "ABORT_ZH_CN ",  " Abort_zh_tw ","  Abort_en_usa ",  " WELCOME_ZH_CN ",  " WELCOME_ZH_TW ",  " Welcome_en_usa ",  "TIMEOUT_ZH_CN",  "TIMEOUT_ZH_TW",  "Timeout_en_usa",  );  $c = Array_merge (Array_diff ($a, $b), Array_diff ($b, $a));  Print_r ($c);? >

Results:

Array (  [0] = ABSENCE_ZH_CN  [1] = ABSENCE_ZH_TW  [2] = Absence_en_usa)

Related recommendations:

Summary of PHP array sorting methods

Ways to convert PHP arrays to and from strings

PHP Array function current () Definition and usage

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.