这是一个多维数组:
[0] => Array (
[order_total_id] => 8160
[order_id] => 2048 [code] => sub_total
[title] => Medzi-súčet
[text] => 5,75€
[value] => 5.7500
[sort_order] => 1 )
[1] => Array (
[order_total_id] => 8161
[order_id] => 2048
[code] => shipping
[title] => Doporučený list
[text] => 2,00€
[value] => 2.0000
[sort_order] => 3 )
[2] => Array (
[order_total_id] => 8162
[order_id] => 2048
[code] => tax
[title] => DPH 20%
[text] => 1,15€
[value] => 1.1500
[sort_order] => 5 )
[3] => Array (
[order_total_id] => 8163
[order_id] => 2048
[code] => total
[title] => Celkom
[text] => 8,90€
[value] => 8.9000
[sort_order] => 6 )
我的问题是:有可能得到[value] => 8.9000
([value]
可以在 md 数组中多次)?我认为正确的方法是首先找到[code] => total
以识别正确的数组,然后在同一个数组中找到 [total] 键。为什么?因为[code] => total
可以在子数组 [0], [1], [2], [3] 中有时只有 [0],[1] 子数组。
如果那行得通,最好找到[code] => shipping
并[value] => 2.0000
感谢你们。