PHP array_diff_assoc
1.函数的作用:比较两个数组的不同,包括键值的区别;
2.函数的参数:
@params array $array1 被比较的数组
@params array $array2 参与比较的数组
@params array $array3 参与比较的数组
....
3. 例子:
$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); $array2 = array("a" => "green", "yellow", "red"); $array3 = array("c" => "blue", 0 => "red"); $result = array_diff_assoc($array1, $array2,$array3); print_r($result);
1 <?php 2 $array1 = array(1,1,2,9,0); 3 $array2 = array("1","01","2","09","a9"); 4 $result = array_diff_assoc($array1, $array2); 5 print_r($result);
输出:
学习记录,方便复习