PHPで多次元配列を並べ替える必要がありますが、私は正しいことができませんし、foreach、whileとwhileループでは苦労しています。多次元php配列の問題を並べ替える
Array
(
[dimension] => Array
(
[dimension.part] => Array
(
[0] => SimpleXMLElement Object
(
[0] => geheel
)
[1] => SimpleXMLElement Object
(
[0] => geheel
)
)
[dimension.type] => Array
(
[0] => SimpleXMLElement Object
(
[0] => hoogte
)
[1] => SimpleXMLElement Object
(
[0] => breedte
)
)
[dimension.value] => Array
(
[0] => SimpleXMLElement Object
(
[0] => 73
)
[1] => SimpleXMLElement Object
(
[0] => 84
)
)
[dimension.unit] => Array
(
[0] => SimpleXMLElement Object
(
[0] => cm
)
[1] => SimpleXMLElement Object
(
[0] => cm
)
)
)
[material] => Array
(
[material.part] => Array
(
[0] => SimpleXMLElement Object
(
[0] => deelmateriaal
)
[1] => SimpleXMLElement Object
(
[0] => deelmateriaal2
)
)
[material_type] => Array
(
[0] => SimpleXMLElement Object
(
[0] => typemateriaal
)
[1] => SimpleXMLElement Object
(
[0] => typemateriaal2
)
)
[material] => Array
(
[0] => SimpleXMLElement Object
(
[0] => materiaal
)
[1] => SimpleXMLElement Object
(
[0] => materiaal2
)
)
[material.notes] => Array
(
[0] => SimpleXMLElement Object
(
[0] => notemateriaal
)
[1] => SimpleXMLElement Object
(
[0] => notemateriaal2
)
)
)
)
そして、私はそれを変換する必要があります:
dimensions => Array (1 => array(dimension.part => geheel)
=> array (dimension.type => hoogte))
.....
=> Array (2 => array(dimension.part => ...)
=> array (dimension.type => ...))
....
....
material => Array (1 => ...
2 => ...
=> Array (1 =>
=>
....
誰もこれまでの良好なアプローチを持っ
これは私が持っているものでしょうか?
おかげで、
ヨリス
多分あなたの闘いの一部を見せてください。 – k102