我定义了一个名为childProducts的空数组。使用foreach循环,我可以获得每个产品的期望变量。这些变量存储在一个名为childProduct的新数组中,然后被推送到childProducts。
我想要做的是删除值3(产品大小)出现多次的所有后续数组。
例如,数组0具有Small,数组1具有Small。数组1可以删除。阵列2具有中,阵列3具有中。数组3可以删除。
我希望这是有道理的。
我目前有:
Array
(
[0] => Array
(
[0] => 1620
[1] => Pack
[2] => 15
[3] => Small
[4] => Pink
)
[1] => Array
(
[0] => 1621
[1] => Pack
[2] => 11
[3] => Small
[4] => Blue
)
[2] => Array
(
[0] => 1623
[1] => Pack
[2] => 22
[3] => Medium
[4] => Pink
)
[3] => Array
(
[0] => 1624
[1] => Pack
[2] => 14
[3] => Medium
[4] => Blue
)
)
但希望拥有:
Array
(
[0] => Array
(
[0] => 1620
[1] => Pack
[2] => 15
[3] => Small
[4] => Pink
)
[2] => Array
(
[0] => 1623
[1] => Pack
[2] => 22
[3] => Medium
[4] => Pink
)
)
我正在寻找要删除的重复颜色。