3
请帮忙!我想验证具有重复的子数组值的数组。我有一个多维数组。我想返回具有重复的product_id值的子数组的键。例如:在我的数组中,我有重复的product_id = 124的子数组。我想返回他们的密钥。具有重复值的多维数组返回键
[purchase_order_products] => Array
(
[0] => Array
(
[product_id] => 124
[barcode] => 480001407081
[item_code] =>
[name] => Brew Kettle Can 330mL
[qty] =>
[unit] => 2
[pcs_have] => 1
[total_pcs] => 1
[cost] => 34.83
[total_item_price] => 34.83
[stocks] =>
[po_qty] =>
)
[1] => Array
(
[product_id] => 125
[barcode] => 480001416108
[item_code] =>
[name] => Colt 45 Can 330mL
[qty] =>
[unit] => 2
[pcs_have] => 1
[total_pcs] => 1
[cost] => 29.58
[total_item_price] => 29.58
[stocks] =>
[po_qty] =>
)
[2] => Array
(
[product_id] => 124
[barcode] => 480001407081
[item_code] =>
[name] => Brew Kettle Can 330mL
[qty] =>
[unit] => 2
[pcs_have] => 1
[total_pcs] => 1
[cost] => 34.83
[total_item_price] => 34.83
[stocks] =>
[po_qty] =>
)
)
我想输出是:
Array(0,2)
整洁,现在尝试写一些代码。 – nogad
我已经更新了我的答案,现在它给出了多个重复对的确切输出。你会看看它,看看它是否能解决你的问题? – glaux