我写了这段代码:
<?php
$aArray = array
(
array(0,0,0),
array(1,0,0),
array(2,0,0),
array(3,0,0),
array(4,0,0),
array(5,0,0),
array(6,0,0),
array(7,0,0)
);
$jump = array
(
array(0,0,0),
array(1,0,0),
array(9,7,4),
array(3,0,0),
array(4,0,0),
array(5,0,0),
array(6,0,0),
array(7,0,0)
);
$result = array_intersect($aArray, $jump);
echo var_dump($result);
我得到的结果是这样的:
array(8) {
[0]=> array(3) {
[0]=> int(0)
[1]=> int(0)
[2]=> int(0) }
[1]=> array(3) {
[0]=> int(1)
[1]=> int(0)
[2]=> int(0) }
[2]=> array(3) {
[0]=> int(2)
[1]=> int(0)
[2]=> int(0) }
[3]=> array(3) {
[0]=> int(3)
[1]=> int(0)
[2]=> int(0) }
[4]=> array(3) {
[0]=> int(4)
[1]=> int(0)
[2]=> int(0) }
[5]=> array(3) {
[0]=> int(5)
[1]=> int(0)
[2]=> int(0) }
[6]=> array(3) {
[0]=> int(6)
[1]=> int(0)
[2]=> int(0) }
[7]=> array(3) {
[0]=> int(7)
[1]=> int(0)
[2]=> int(0) }
}
为什么第二个索引不返回 null?我已经尝试清空我的缓存,以防它在那里存储旧值。我还注意到,如果我从跳转数组中删除最后一个数组,它仍然会产生 7,0,0。这是一个奇怪的异常吗?