Heim > Fragen und Antworten > Hauptteil
Frage: Was ich möchte, ist die PID eines Arrays. Ist sie im zweiten Array vorhanden? Wenn beide vorhanden sind, ist die ID des ersten Arrays die ID des untergeordneten Arrays. Wenn sie gleich sind, entfernen Sie alle verbleibenden untergeordneten Elemente des zweiten Arrays und behalten Sie nur die gleichen bei
Array 1:
Array
(
[0] => Array
[1] => ; Array
( = [Pid] = & gt; 52
[id] = & gt; 54
)
[2] = & gt; Array
(
[pid] = & gt; 55
[id] = > 56
)
[3] => Array
(
) [pid] => 58
[id] t; 60
)
[4] => ; Array
: Array ( [0] => ; Array ( ] => 48 [attribute_name] => Mainland Bank of China
;) 1 [1] = & gt; Array
( [ID] = & gt; 52 [pid] = & gt; 0 [Typ] = & gt; 2 [Attributname] = & gt; Apple-Garantiezeit [childer] = & gt; array ( [0] = & gt; array ( [id] = & gt; 53 [pid] = & gt; 52 [Typ] => 2 Attribut_Name] . = & gt; 2%) ) ) [2] = & gt; ( [id] = & gt; 55 [pid] = & gt; 0[childer] => Array
(
[0] = & gt; Array
(
[id] = & gt; 56
[pid] = & gt; 55
[type] = & gt; 2
[Attribute_name] = & gt ; A1863全网通
[1] => Array
(
[id] => [pid] =>
[Typ] = & GT; Array ( [id] => 58 [pid] => 0 [type] => 2 tribut_name] => 机身颜色 [childer] => Array ( [0] => Array [id] =>[pid] => 58
[Typ] => 2
[attribute_name] => 金色
[price_percentage] => 2%
)
[1] => Array
(
[id] = & gt; 60
[pid] = & gt; 58
[type] = & gt; 2
[Attribute_name] = & gt; 白色
[price_percentage] = & gt; 2%
)
[2] => Array
(
[id] = & gt; 61
[pid] = & gt; 58
[type] = & gt; 2
[Attribute_Name] = & gt; 黑色
[price_percentage] = & gt; 2%
)
[3] => Array
(
[Typ] => 2
[attribute_name] => 红色
[price_percentage] => 2%
)
)
)
[4] => Array
(
[id] => 63
[pid] => 0
[type] => 2
[at tribut_name] => 存储容量
[childer] =>
(
[0] = & gt; Array
(
[id] = & gt; 64
[pid] = & gt; 63
[type] = & gt; 2
[sredUn_name] = & gt; 256G
1] => Array
(
[id] => 65
gt; 63
] => 2
)
[2] => Array
(
[price_percentage] =>
)
)
)
)