How does PHP find the different elements in two arrays? This article mainly introduces the PHP implementation of query Two array of different elements of the method, involving the PHP array difference set operation and array merging related techniques, the need for friends can refer to. We hope to help you.
<?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);? >
Results:
Array ( [0] = ABSENCE_ZH_CN [1] = ABSENCE_ZH_TW [2] = Absence_en_usa)
Related recommendations:
Summary of PHP array sorting methods
Ways to convert PHP arrays to and from strings
PHP Array function current () Definition and usage