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常见数据库操作技巧汇总

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/08d765cc41d85cddc247a1423d8ec39e.html