Wie transponiere ich ein assoziatives Array indizierter Arrays? [Duplikat]
Posted: 17 Jan 2025, 05:46
Ich habe ein Array wie dieses in PHP:
Ich möchte aus dem obigen Array ein neues Array wie folgt erstellen:
Code: Select all
Array
(
[Color] => Array
(
[0] => Pink
[1] => Pink
[2] => Pink
[3] => Pink
)
[Size] => Array
(
[0] => S
[1] => S
[2] => S
[3] => M
)
[Brand] => Array
(
[0] => Raymond
[1] => Levis
[2] => Lee
[3] => Raymond
)
[price] => Array
(
[0] => 1500
[1] => 1500
[2] => 1500
[3] => 1600
)
[quantity] => Array
(
[0] => 2
[1] => 2
[2] => 2
[3] => 3
)
)
Code: Select all
Array(
[0] => Array
(
[Color] => Pink
[Size] => S
[Brand] => Raymond
[price] => 1500
[quantity] => 2
)
[1] => Array
(
[Color] => Pink
[Size] => S
[Brand] => Levis
[price] => 1500
[quantity] => 2
)
),
// and so on.