我有一个这样的数组:
Array
(
[2] => Array
(
[0] => name2 surname
[1] => email2@email.com
[2] => 834502034
[3] => image url3
)
[3] => Array
(
[0] => name3 surname
[1] => email2@email.com
[2] => 7648484886
[3] => image url3
)
[0] => Array
(
[0] => name0 surname
[1] => email0@email.com
[2] => 56783658658
[3] => image url0
)
[1] => Array
(
[0] => name1 surname
[1] => email1@email.com
[2] => 7648484886
[3] => image url1
)
)
您会注意到一些值是相同的,并且可能只有一个值差异。
我需要找出另一个单个数组是否与任何子数组匹配并返回密钥。
我要匹配的数组不是多维的:
Array
(
[0] => name1 surname
[1] => email1@email.com
[2] => 7648484886
[3] => image url1
)
如何确定我的单个数组是否在主数组中并返回 KEY?我已经尝试使用带有回调的array_diff_uassoc,它返回不匹配的键=> 数组,我想我可以匹配两个结果的计数以查看是否存在差异,但我仍然需要匹配数组的键。我要比较的数组将始终具有确切的值 [0]、[1]、[2] 和 [3]。