【发布时间】:2017-03-17 16:50:07
【问题描述】:
我有一个 xml 节点,其结构如下:
<ItemDimensions>
<Height Units="hundredths-inches">42</Height>
<Length Units="hundredths-inches">752</Length>
<Weight Units="hundredths-pounds">69</Weight>
<Width Units="hundredths-inches">453</Width>
</ItemDimensions>
我如何循环这个 XML 并将属性、单位和值放入一个数组中?
例如我想构建一个如下所示的数组:
$itemDimensions = array(
array('height','hundredths-inches',24),
array('length,','hundredths-inches',752),
array('weight','hundredths-pounds',69),
array('width','hundredths-inches',453),
)
【问题讨论】: