Home > Backend Development > PHP Tutorial > PHP implements the method of querying different elements in two arrays, php array_PHP tutorial

PHP implements the method of querying different elements in two arrays, php array_PHP tutorial

WBOY
Release: 2016-07-12 08:58:45
Original
716 people have browsed it

PHP implements the method of querying different elements in two arrays, php array

This article describes the example of PHP implementing the method of 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 string (string) usage summary", "php mysql database operation introductory tutorial" and "php mysql database operation introductory tutorial" Summary of common database operation skills in PHP》

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

Articles you may be interested in:

  • How to query and delete duplicate data in multiple columns of the database using PHP (implemented using array functions)
  • PHP queries the mysql database and saves the results Method to array
  • thinkphp data query and traverse array instance
  • ThinkPHP query method to return simple field array
  • php method to implement multi-condition query through array (string splitting )
  • php code to quickly query the parent key and parent key value based on the key name in a multi-dimensional array
  • php array operation (add, delete, query, sort) and other function descriptions
  • php method to randomly split a string into arrays of different lengths
  • php method to delete duplicate elements in an array
  • php method to count the number of array elements

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1102464.htmlTechArticlePHP implements the method of querying different elements in two arrays, php arrays. This article describes the PHP implementation of querying two arrays. methods for different elements. Share it with everyone for your reference, the details are as follows...
Related labels:
php
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