Home > Backend Development > PHP Tutorial > PHP implements method of querying different elements in two arrays

PHP implements method of querying different elements in two arrays

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-29 09:02:05
Original
1016 people have browsed it

The example in this article describes how PHP implements querying different elements in two arrays. Share it with everyone for your reference, the details are as follows:

<&#63;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);
&#63;>

Copy after login

Result:

Array
(
  [0] => absence_zh_cn
  [1] => absence_zh_tw
  [2] => absence_en_usa
)

Copy after login

Readers who are interested in more PHP-related content can check out the special topics of this site: "php object-oriented programming introductory tutorial", "php "Summary of String Usage", "Introduction Tutorial on PHP+MySQL Database Operation" and "Summary of Common PHP Database Operation Skills"

I hope this article will be helpful to everyone in PHP programming.

The above introduces the method of querying different elements in two arrays in PHP, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template