Home > Article > Backend Development > PHP实现查询两个数组中不同元素的方法_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 )
更多关于PHP相关内容感兴趣的读者可查看本站专题:《php面向对象程序设计入门教程》、《php字符串(string)用法总结》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总》
希望本文所述对大家PHP程序设计有所帮助。