我有两个多维数组,第一个是索引,其子数组是关联数组。
Array
(
[0] => Array
(
[layout_id] => 1
[element_id] => 1
)
[1] => Array
(
[layout_id] => 1
[element_id] => 2
)
[2] => Array
(
[layout_id] => 1
[element_id] => 4
)
[3] => Array
(
[layout_id] => 1
[element_id] => 5
)
[4] => Array
(
[layout_id] => 1
[element_id] => 6
)
)
和
Array
(
[0] => Array
(
[layout_id] => 1
[element_id] => 1
)
[1] => Array
(
[layout_id] => 1
[element_id] => 2
)
[2] => Array
(
[layout_id] => 1
[element_id] => 5
)
[3] => Array
(
[layout_id] => 1
[element_id] => 8
)
)
修改 预期结果应为
Array
(
[0] => Array
(
[layout_id] => 1
[element_id] => 1
)
[1] => Array
(
[layout_id] => 1
[element_id] => 2
)
[2] => Array
(
[layout_id] => 1
[element_id] => 5
)
)
两个阵列的长度可能不同。 我想要来自这两个数组的重复条目。在php中有内置函数来执行此操作吗?
谢谢
答案 0 :(得分:0)
使用array_uintersect()来使用自定义比较函数,如下所示:
using (var vw = WebCore.CreateWebView(100,100))
{
vw.Source = new Uri("website");
while (vw.IsLoading)
{
WebCore.Update();
}
var surface = (BitmapSurface)vw.Surface;
surface.SaveToPNG("screen1.png");
surface.Resized += (s, e) =>
{
// Save the updated buffer to a new PNG image.
surface.SaveToPNG("screen2.png");
WebCore.Shutdown();
};
var x = vw.ExecuteJavascriptWithResult("document.body.scrollWidth").ToString();
var y = vw.ExecuteJavascriptWithResult("document.body.scrollHeight").ToString();
vw.Resize(Convert.ToInt32(x), Convert.ToInt32(y));
WebCore.Run();
}
如果customCompare返回0,则表示$ val1和$ val2相等。