是什么array_udiff_assoc和array_diff_uassoc之间的差 [英] what is the difference between array_udiff_assoc and array_diff_uassoc
问题描述
是什么array_udiff_assoc和array_diff_uassoc
what is the difference between array_udiff_assoc and array_diff_uassoc
有关array_udiff_assoc我得到这个事情
for array_udiff_assoc i get this thing
<?php
function myfunction($v1,$v2)
{
if ($v1===$v2)
{
return 0;
}
return 1;
}
$a1=array("a"=>"Cat","b"=>"Dog","c"=>"Horse");
$a2=array("a"=>"Cat","b"=>"Horse","c"=>"Dog");
print_r(array_udiff_assoc($a1,$a2,"myfunction"));
?>
结果
Array ( [b] Dog [c] => Horse )
也array_diff_uassoc
also array_diff_uassoc
<?php
function myfunction($v1,$v2)
{
if ($v1===$v2)
{
return 0;
}
return 1;
}
$a1=array("a"=>"Cat","b"=>"Dog","c"=>"Horse");
$a2=array("a"=>"Cat","b"=>"Horse","c"=>"Dog");
print_r(array_diff_uassoc($a1,$a2,"myfunction"));
?>
结果是一样的第一个
result is same as first one
Array ( [b] Dog [c] => Horse )
时的有什么区别,如果有那是什么。 PHP手册不说,他们是别名,因为他们常说。
Is the have any difference, if have what is that. Php manual does not says that they are alias, as they used to say.
推荐答案
他们都做同样的,但 udiff-assoc命令
比较与用户提供的函数中的数据,而差异-uassoc
与用户提供的函数的指数比。
They both do the same, but udiff-assoc
compares the DATA with the user supplied function, while diff-uassoc
compares the INDEX with the user supplied function.
作为一个答案@lonsesomeday:由U, diff_assoc
将使用内部函数对所有的比较,而 udiff_uassoc 指示code>用途索引和数据比较提供的回调。
As an answer to @lonsesomeday : as indicated by the 'u', diff_assoc
will use internal functions for all comparisons, and udiff_uassoc
uses provided callbacks for index and data comparison.
http://www.php.net/manual/ EN / function.array的Diff-uassoc.php
http://www.php.net/manual/ EN / function.array-udiff-assoc.php
这篇关于是什么array_udiff_assoc和array_diff_uassoc之间的差的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!