0
我有兩個數組$ a和$ b。php中的多維數組差異
$a = Array
(
[0] => Array
(
[a] => 1
[d] => CONTACT
[f] => 2
)
)
and
$b = Array
(
[0] => Array
(
[a] => 1
[b] => 1
[c] => 4
[d] => CONTACT
[e] => 2012-08-07 05:56:18
[f] => 2
)
[1] => Array
(
[a] => 2
[b] => 3
[c] => 4
[d] => CONTACT
[e] => 2012-08-07 05:56:18
[f] => 1
)
[2] => Array
(
[a] => 2
[b] => 4
[c] => 4
[d] => CONTACT
[e] => 2012-08-07 05:56:18
[f] => 1
)
)
如果第一個數組的a,d,f字段與第二個數組匹配,我想刪除第二個數組的父數組。在這種情況下, 我想做unset($b[0]);
。如何在沒有循環的情況下做到這一點?如果不能,給我一個循環的解決方案。在cakephp中有沒有任何方法?
第一個數組有'a,d,f'鍵。你能澄清嗎? – tigrang 2012-08-07 06:19:59
爲什麼你不想使用循環? – 2012-08-07 06:22:23
數組可能包含500行。我認爲循環會消耗很多處理能力 – EbinPaulose 2012-08-07 06:25:42