<?phpfunction diffarray ($arr 1 , $arr 2 ) {$arrRet = array ();foreach ($arr 1 as $key => $value) {if ($arr 1[$key] != $arr 2[$key]) {if (Array_key_exists ($key, $arrRet) {Array_push ($arrRet, $key);} else{$arrRet []= $key;}}} return $arrRet;} $arr 1 = array ("Channelnameshort" => "Baidu Time Company", "ChannelName" Baidu Time Responsibility Co., Ltd. ", " RAWURL "=" http://www.baidu.com ", " logourl "=" "http://t11.baidu.com/it/u=3114404026,3614407463&fm=58", "channeltype" = array ( "210010004", "210010007",),); $arr 2 = Array ("Channelnameshort" => "Baidu Time Company", "channelname" = "Baidu Online Company", "RawUrl" = "http://www.baidu.com", "Logourl" => "/HTTP/ T11.baidu.com/it/u=3114404026,3614407463&fm=58 ", "Channeltype" => array ( "210010004", "210010017",), Var_dump (Diffarray ($arr 1, $arr 2));
Results:
Array 0 = String ' channelname ' (length=11) 1 = = String ' Channeltype ' (length=11)
This article is from the "dream to think XI" blog, please be sure to keep this source http://qiangmzsx.blog.51cto.com/2052549/1553325
PHP vs. two different elements in a data