PHP implements method of querying different elements in two arrays

不言
Release: 2023-03-30 13:50:02
Original
1339 people have browsed it

This article mainly introduces the method of querying different elements in two arrays in PHP, involving related skills of PHP array difference operation and array merging. Friends in need can refer to the following

The examples of this article are described PHP implements a method to query different elements in two arrays. Share it with everyone for your reference, the details are as follows:

<?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);
?>
Copy after login

Result:

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

The above is the entire content of this article, I hope it will help everyone learn Helpful, please pay attention to the PHP Chinese website for more related content!

Related recommendations:

php realizes the effect of mysql connection pool

3 methods of PHP looping through arrays list( ), each() and while summary

php array function sequence shuffle() and array_rand() introduction to the use of random functions

The above is the detailed content of PHP implements method of querying different elements in two arrays. For more information, please follow other related articles on the PHP Chinese website!

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