Rumah > Artikel > pembangunan bahagian belakang > PHP查询两个数组中不同元素的代码分享
本文主要和大家分享PHP查询两个数组中不同元素的代码希望能帮助到大家。
<?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); ?>
结果:
Array ( [0] => absence_zh_cn [1] => absence_zh_tw [2] => absence_en_usa )
相关推荐:
Atas ialah kandungan terperinci PHP查询两个数组中不同元素的代码分享. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!