Home >Backend Development >PHP Tutorial >PHP implements method of querying different elements in two arrays
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:
<?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); ?>
Result:
Array ( [0] => absence_zh_cn [1] => absence_zh_tw [2] => absence_en_usa )
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.