Как переназначить индексы с ассоциативными ключами, используя значение столбца?

Мне нужна помощь, чтобы заменить некоторые конкретные индексы подмассива ассоциативными ключами в моем многомерном массиве.

Мои данные поступают из XML-файла из другой системы.

Для моего следующего процесса (Импорт в другую систему) мне нужны эти ассоциативные ключи.

Вот соответствующая часть моего массива:

ARRAY
(
[123456]
(
[navpath] => Array
[data] => 1
[...] => ...
[merkmale]
(
[gruppe]
(
[0]
(
[name] => Saisonartikel
[wert] => nein
[einheit]
(
....
)
)
[1]
(
[name] => Warengruppenspezifische Angaben
[wert] => nein
[einheit]
(
....
)
)
[2]
(
[name] => Qualität
[wert] => nein
[einheit]
(
....
)
)
[3]
(
[name] => Weitere gesetzliche Angaben
[wert] => nein
[einheit]
(
....
)
)
....
)
)
)
[329203]
(
....
)
....
)

Мне нужен этот результат:

ARRAY
(
[123456]
(
[navpath] => Array
[data] => 1
[...] => ...
[merkmale]
(
[gruppe]
(
[Saisonartikel]
(
[name] => Saisonartikel
[wert] => nein
[einheit]
(
....
)
)
[Warengruppenspezifische Angaben]
(
[name] => Warengruppenspezifische Angaben
[wert] => nein
[einheit]
(
....
)
)
[Qualität]
(
[name] => Qualität
[wert] => nein
[einheit]
(
....
)
)
[Weitere gesetzliche Angaben]
(
[name] => Weitere gesetzliche Angaben
[wert] => nein
[einheit]
(
....
)
)
....
)
)
)
[329203]
(
....
)
....
)
[РЕДАКТИРОВАТЬ] В частности, мне нужны новые имена ключей после [merkmale][gruppe],

Вот var_export() полного массива:

array ( 'navpath' => array ( 'name' => 'Trockenware : Fertiggerichte, Convenience : Dessert, Nachspeisen : Puddingpulver', 'id' => '11395 : 4067 : 4145 : 4559', ), 'ECO_ID' => '161510', 'LMIV_READY' => '100', 'GEAENDERT_AM' => '28.06.2018', 'ARTNR_VPE1' => '11999', 'marke' => array ( '@attributes' => array ( 'ECO_MRKID' => '1372', ), 'MRK_NAME' => 'Biovegan', 'ECO_MRKKURZ' => 'BEVG', 'MRK_LOGO' => '/logos/marken/BEVG.jpg', 'FRM_NAME1' => 'Biovegan GmbH', ), 'INHALT' => '124', 'EINHEIT' => 'g', 'qualitaeten' => array ( 'qualitaet' => array ( 0 => array ( '@attributes' => array ( 'spalte' => '2', 'logo_rang' => '0', ), 'BIO_QUALITAET' => '100% bio', 'QUAL_LOGO' => array ( ), 'QU_FPID' => '0', ), 1 => array ( '@attributes' => array ( 'spalte' => '7', 'logo_rang' => '0', ), 'BIO_QUALITAET' => 'EWG 834/2007 Norm', 'QUAL_LOGO' => array ( ), 'QU_FPID' => '0', ), 2 => array ( '@attributes' => array ( 'spalte' => '3', 'logo_rang' => '3', ), 'BIO_QUALITAET' => 'Bio-Siegel', 'QUAL_LOGO' => '/logos/firmen/biosiegel_icon.jpg', 'QU_FPID' => '985', ), 3 => array ( '@attributes' => array ( 'spalte' => '3', 'logo_rang' => '2', ), 'BIO_QUALITAET' => 'EU Bio-Logo', 'QUAL_LOGO' => '/logos/firmen/eu_biosiegel_icon.jpg', 'QU_FPID' => '0', ), 4 => array ( '@attributes' => array ( 'spalte' => '4', 'logo_rang' => '0', ), 'BIO_QUALITAET' => 'EU Landwirtschaft / Nicht EU Landwirtschaft', 'QUAL_LOGO' => array ( ), 'QU_FPID' => '0', ), 5 => array ( '@attributes' => array ( 'spalte' => '10', 'logo_rang' => '0', ), 'BIO_QUALITAET' => 'Glutenfrei Ähre der DZG', 'QUAL_LOGO' => '/logos/firmen/dzg_icon.jpg', 'QU_FPID' => '479', ), ), ), 'kontrollstellen' => array ( 'kontrollstelle' => array ( 'KONTRST_NAME' => 'ABCERT AG', 'KONTRST_KURZNAME' => 'ABCERT', 'KONTRST_NR' => 'DE-ÖKO-006', ), ), 'legende' => array ( 'ZUTATENLEGENDE' => '*kontrolliert biologischer Anbau ', 'VOLLDEKLARATION' => 'Diese Zutatenliste entspricht einer Volldeklaration im Sinne der Richtlinien des Bundesverbandes Naturkost & Naturwaren.', 'AROMATISIERUNG' => 'Dieses Produkt ist nicht aromatisiert.', 'ANLAGE_3A' => array ( ), 'ALLERGIE_DIAET' => array ( ), 'ALLERGIELEGENDE' => array ( ), ), 'LAGER_VERB' => array ( 0 => 'Trocken lagern und vor Wärme schützen.', 1 => 'Trocken lagern und vor Wärme schützen.', ), 'ECO_WGRUP' => '4559', 'EAN_STUECK' => '4005394284278', 'PRODNAME' => 'Crumble Mix Mandel, Bio', 'HERKUNFT_ISO' => 'DE', 'HERKUNFT' => 'Deutschland (DE)', 'WECHSELNDE_URSPRUNGSLAENDER' => 'ja', 'URSPRUNG' => 'Diverse Länder', 'SLOGAN' => 'Mandelstreusel für Desserts!', 'ZUTAT' => 'Maismehl*, Reismehl*, Rohrohrzucker*, MANDELMEHL* (14,5 %), Amaranthmehl*, Bourbon-Vanille*, Himalayasalz1. *aus kontrolliert biologischem Anbau 1aus der Salt Range in Pakistan', 'ZUTLEG' => 'ja', 'AROMA' => 'nicht', 'VOLLDEK' => 'ja', 'ALLGEMEIN' => 'Wer Streuselkuchen liebt, wird von diesem Dessert nicht genug bekommen. Das Besondere: Der Teigboden wird weggelassen und das Obst wird mit leckeren Streuseln bedeckt.', 'KURZBESCHREIBUNG' => 'Crumble Mix Mandel, Bio', 'BESONDER' => 'Den Crumble kann man heiß oder kalt genießen.', 'ZUBEREIT' => 'Zutaten für Pfirsich-Mandel Crumble: 1 Packung Biovegan Crumble Mix Mandel, 50 g Margarine (oder Kokosfett / Butter), 1 Glas Pfirsiche (ca. 360 g / Abtropfgewicht). Zubereitung: Backofen vorheizen, (Umluft ca. 170° C, Ober-/ Unterhitze ca. 180° C), Pfirsiche abtropfen lassen und zu kleinen Würfeln schneiden und gleichmäßig in einer Auflaufform verteilen (ø 22 cm oder eckig ca. 22 x 18 cm). Packungsinhalt mit 50 g weicher Margarine in einen Rührbecher geben. Mit der Hand zu einem Streuselteig verkneten und in gewünschter Größe über den Pfirsichen verteilen, etwas andrücken und auf mittlerer Schiene für ca. 25 Min. backen.', 'HERSTELL' => 'Für den Crumble können auch beliebige andere Früchte verwendet werden. Bei frischen Früchten bitte beachten: Früchte sehr klein schneiden, sowie 100 ml Wasser und 2 EL Zitronensaft hinzufügen, für die Variante mit Apfel stets 175 ml Wasser verwenden. Bei gefrorenem Obst: 2 EL Zitronensaft hinzufügen, bei stark saftenden Früchten eine Packung Biovegan Sahnesteif hinzufügen.', 'BEZUG_NAEHRWERTBERECHNUNG' => 'g', 'merkmale' => array ( 'gruppe' => array ( 0 => array ( '@attributes' => array ( 'id' => '55', ), 'name' => 'Warengruppenspezifische Angaben', 'merkmal' => array ( 0 => array ( '@attributes' => array ( 'id' => 'RECHT_STATUS', ), 'name' => 'Rechtlicher Status', 'wert' => 'Lebensmittel', 'einheit' => array ( ), ), 1 => array ( '@attributes' => array ( 'id' => 'SAISONARTIKEL', ), 'name' => 'Saisonartikel', 'wert' => 'nein', 'einheit' => array ( ), ), 2 => array ( '@attributes' => array ( 'id' => 'SUESSUNG', ), 'name' => 'Süßung', 'wert' => 'Rohrohrzucker', 'einheit' => array ( ), ), 3 => array ( '@attributes' => array ( 'id' => 'SALZART', ), 'name' => 'Salzart', 'wert' => 'Steinsalz', 'einheit' => array ( ), ), 4 => array ( '@attributes' => array ( 'id' => 'GARMETHODE', ), 'name' => 'Garmethode', 'wert' => 'Backofen Umluft', 'einheit' => array ( ), ), 5 => array ( '@attributes' => array ( 'id' => 'NITRITSALZ', ), 'name' => 'Nitritpökelsalz', 'wert' => 'nein', 'einheit' => array ( ), ), ), ), 1 => array ( '@attributes' => array ( 'id' => '0', ), 'name' => 'Qualität', 'merkmal' => array ( 0 => array ( '@attributes' => array ( 'id' => 'BIOLOGISCH', ), 'name' => 'Bio-Erzeugnis', 'wert' => 'ja', 'einheit' => array ( ), ), 1 => array ( '@attributes' => array ( 'id' => 'QUALI_ANTEIL', ), 'name' => 'Anteil an Bio-Zutaten', 'wert' => '100% bio', 'einheit' => array ( ), ), 2 => array ( '@attributes' => array ( 'id' => 'QUALI_STAATLICH', ), 'name' => 'Staatliche Siegel', 'wert' => 'Bio-Siegel, EU Bio-Logo', 'einheit' => array ( ), ), 3 => array ( '@attributes' => array ( 'id' => 'QUALI_EULOGO', ), 'name' => 'Länderzusatz des EU-Logos', 'wert' => 'EU Landwirtschaft / Nicht EU Landwirtschaft', 'einheit' => array ( ), ), 4 => array ( '@attributes' => array ( 'id' => 'KONTROLLE', ), 'name' => 'Öko-Kontrollstelle', 'wert' => 'DE-ÖKO-006', 'einheit' => array ( ), ), 5 => array ( '@attributes' => array ( 'id' => 'QUALI_STANDARD', ), 'name' => 'Welcher Standard wird erfüllt', 'wert' => 'EWG 834/2007 Norm', 'einheit' => array ( ), ), 6 => array ( '@attributes' => array ( 'id' => 'QUALI_SONST', ), 'name' => 'Weitere Qualitätskriterien und Labels', 'wert' => 'Glutenfrei Ähre der DZG', 'einheit' => array ( ), ), ), ), 2 => array ( '@attributes' => array ( 'id' => '60', ), 'name' => 'Weitere gesetzliche Angaben', 'merkmal' => array ( 0 => array ( '@attributes' => array ( 'id' => 'ZUSATZSTOFFE', ), 'name' => 'Zusatzstoffe, Rechtlicher Hinweis', 'wert' => 'Keine deklarationspflichtigen Zusatzstoffe vorhanden', 'einheit' => array ( ), ), 1 => array ( '@attributes' => array ( 'id' => 'VERKAUFSBEZ', ), 'name' => 'Bezeichnung des Lebensmittels', 'wert' => '#-#Torte', 'einheit' => array ( ), ), 2 => array ( '@attributes' => array ( 'id' => 'INVERKEHRBRINGER', ), 'name' => 'Inverkehrbringer', 'wert' => 'Biovegan GmbH, Biovegan-Allee 1, D-56579 Bonefeld', 'einheit' => array ( ), ), ), ), 3 => array ( '@attributes' => array ( 'id' => '21', ), 'name' => 'Nährwerte & Analyseergebnisse bezogen auf 100 g', 'merkmal' => array ( 0 => array ( '@attributes' => array ( 'id' => 'ENERGIE', ), 'name' => 'Energie kJ / kcal', 'wert' => '1689 kJ / 401 kcal', 'einheit' => array ( ), ), 1 => array ( '@attributes' => array ( 'id' => 'FETT', ), 'name' => 'Fett', 'wert' => '9,2', 'einheit' => 'g', ), 2 => array ( '@attributes' => array ( 'id' => 'GESAETT_FETT', ), 'name' => 'davon gesättigte Fettsäuren', 'wert' => '1,1', 'einheit' => 'g', ), 3 => array ( '@attributes' => array ( 'id' => 'KOHLHYD', ), 'name' => 'Kohlenhydrate', 'wert' => '70', 'einheit' => 'g', ), 4 => array ( '@attributes' => array ( 'id' => 'ZUCKER', ), 'name' => 'davon Zucker', 'wert' => '27', 'einheit' => 'g', ), 5 => array ( '@attributes' => array ( 'id' => 'BALLAST', ), 'name' => 'Ballaststoffe', 'wert' => '3,4', 'einheit' => 'g', ), 6 => array ( '@attributes' => array ( 'id' => 'EIWEISS', ), 'name' => 'Eiweiß', 'wert' => '7,4', 'einheit' => 'g', ), 7 => array ( '@attributes' => array ( 'id' => 'KOCHSALZ', ), 'name' => 'Salz', 'wert' => '0,08', 'einheit' => 'g', ), 8 => array ( '@attributes' => array ( 'id' => 'NAEHRWERT_ERMITTLUNG', ), 'name' => 'Ermittlung der Nährwerte durch', 'wert' => 'Berechnung', 'einheit' => array ( ), ), ), ), 4 => array ( '@attributes' => array ( 'id' => '1', ), 'name' => 'Allergiehinweise', 'merkmal' => array ( 0 => array ( '@attributes' => array ( 'id' => 'EIER', ), 'name' => 'Eier', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 1 => array ( '@attributes' => array ( 'id' => 'ERDNUSS', ), 'name' => 'Erdnuss', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 2 => array ( '@attributes' => array ( 'id' => 'FISCH', ), 'name' => 'Fisch', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 3 => array ( '@attributes' => array ( 'id' => 'GLUTEN', ), 'name' => 'Gluten', 'wert' => 'Ausschluss garantiert', 'einheit' => array ( ), ), 4 => array ( '@attributes' => array ( 'id' => 'KRUSTENTIER', ), 'name' => 'Krebstier', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 5 => array ( '@attributes' => array ( 'id' => 'LUPINE', ), 'name' => 'Lupine', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 6 => array ( '@attributes' => array ( 'id' => 'MILCH', ), 'name' => 'Milch', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 7 => array ( '@attributes' => array ( 'id' => 'NUSS', ), 'name' => 'Schalenfrüchte', 'wert' => 'Spuren möglich', 'einheit' => array ( ), ), 8 => array ( '@attributes' => array ( 'id' => 'SELLERIE', ), 'name' => 'Sellerie', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 9 => array ( '@attributes' => array ( 'id' => 'SENF', ), 'name' => 'Senf', 'wert' => 'Spuren möglich', 'einheit' => array ( ), ), 10 => array ( '@attributes' => array ( 'id' => 'SESAM', ), 'name' => 'Sesam', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 11 => array ( '@attributes' => array ( 'id' => 'SOJA', ), 'name' => 'Soja', 'wert' => 'Spuren möglich', 'einheit' => array ( ), ), 12 => array ( '@attributes' => array ( 'id' => 'WEICHTIER', ), 'name' => 'Weichtier', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 13 => array ( '@attributes' => array ( 'id' => 'CASHEWNUSS', ), 'name' => 'Cashewnuss', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 14 => array ( '@attributes' => array ( 'id' => 'DINKEL', ), 'name' => 'Dinkel', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 15 => array ( '@attributes' => array ( 'id' => 'FRUCTOSE', ), 'name' => 'Fruktose', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 16 => array ( '@attributes' => array ( 'id' => 'GEMUESE', ), 'name' => 'Gemüse / Hülsenfrüchte', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 17 => array ( '@attributes' => array ( 'id' => 'GERSTE', ), 'name' => 'Gerste', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 18 => array ( '@attributes' => array ( 'id' => 'GLUTAMAT', ), 'name' => 'Glutamat', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 19 => array ( '@attributes' => array ( 'id' => 'HAFER', ), 'name' => 'Hafer', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 20 => array ( '@attributes' => array ( 'id' => 'HASELNUSS', ), 'name' => 'Haselnuss', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 21 => array ( '@attributes' => array ( 'id' => 'HEFE', ), 'name' => 'Hefe', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 22 => array ( '@attributes' => array ( 'id' => 'HUHN', ), 'name' => 'Huhn', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 23 => array ( '@attributes' => array ( 'id' => 'KAKAO', ), 'name' => 'Kakao', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 24 => array ( '@attributes' => array ( 'id' => 'KAMUT', ), 'name' => 'Kamut', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 25 => array ( '@attributes' => array ( 'id' => 'KORIANDER', ), 'name' => 'Koriander', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 26 => array ( '@attributes' => array ( 'id' => 'KUHMILCHEIWEISS', ), 'name' => 'Kuhmilcheiweiß', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 27 => array ( '@attributes' => array ( 'id' => 'LACTOSE', ), 'name' => 'Laktose', 'wert' => 'Ausschluss garantiert', 'einheit' => array ( ), ), 28 => array ( '@attributes' => array ( 'id' => 'MACADAMIANUSS', ), 'name' => 'Macadamianuss', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 29 => array ( '@attributes' => array ( 'id' => 'MAIS', ), 'name' => 'Mais', 'wert' => 'enthalten', 'einheit' => array ( ), ), 30 => array ( '@attributes' => array ( 'id' => 'MANDELN', ), 'name' => 'Mandeln', 'wert' => 'enthalten', 'einheit' => array ( ), ), 31 => array ( '@attributes' => array ( 'id' => 'MILCHEIWEISS', ), 'name' => 'Milcheiweiß', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 32 => array ( '@attributes' => array ( 'id' => 'PARANUSS', ), 'name' => 'Paranuss', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 33 => array ( '@attributes' => array ( 'id' => 'PECANUSS', ), 'name' => 'Pecanuss', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 34 => array ( '@attributes' => array ( 'id' => 'PFEFFER', ), 'name' => 'Pfeffer', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 35 => array ( '@attributes' => array ( 'id' => 'PISTAZIE', ), 'name' => 'Pistazie', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 36 => array ( '@attributes' => array ( 'id' => 'PURIN', ), 'name' => 'Purin', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 37 => array ( '@attributes' => array ( 'id' => 'QUEENSLANDNUSS', ), 'name' => 'Queenslandnuss', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 38 => array ( '@attributes' => array ( 'id' => 'RIND', ), 'name' => 'Rind', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 39 => array ( '@attributes' => array ( 'id' => 'ROGGEN', ), 'name' => 'Roggen', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 40 => array ( '@attributes' => array ( 'id' => 'SAIZILAT', ), 'name' => 'Salicylat', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 41 => array ( '@attributes' => array ( 'id' => 'SCHWEIN', ), 'name' => 'Schwein', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 42 => array ( '@attributes' => array ( 'id' => 'UMBELLIFEREAE', ), 'name' => 'Umbelliferae', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 43 => array ( '@attributes' => array ( 'id' => 'WALNUSS', ), 'name' => 'Walnuss', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 44 => array ( '@attributes' => array ( 'id' => 'WEIZEN', ), 'name' => 'Weizen', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), 45 => array ( '@attributes' => array ( 'id' => 'ZIMT', ), 'name' => 'Zimt', 'wert' => 'nicht enthalten', 'einheit' => array ( ), ), ), ), 5 => array ( '@attributes' => array ( 'id' => '58', ), 'name' => 'Weitere Eigenschaften', 'merkmal' => array ( 0 => array ( '@attributes' => array ( 'id' => 'VEGAN', ), 'name' => 'vegan', 'wert' => 'ja', 'einheit' => array ( ), ), 1 => array ( '@attributes' => array ( 'id' => 'VEGETARISCH', ), 'name' => 'vegetarisch', 'wert' => 'ja', 'einheit' => array ( ), ), 2 => array ( '@attributes' => array ( 'id' => 'ROHKOST', ), 'name' => 'Rohkostqualität', 'wert' => 'nein', 'einheit' => array ( ), ), 3 => array ( '@attributes' => array ( 'id' => 'UNGESUESST', ), 'name' => 'ungesüßt', 'wert' => 'nein', 'einheit' => array ( ), ), ), ), 6 => array ( '@attributes' => array ( 'id' => '3', ), 'name' => 'Angaben zur VE (VerbrauchsEinheit / Einzel)', 'merkmal' => array ( 0 => array ( '@attributes' => array ( 'id' => 'VERP_STUECK', ), 'name' => 'Verpackungsmaterial', 'wert' => 'Papier, Alu, PE', 'einheit' => array ( ), ), 1 => array ( '@attributes' => array ( 'id' => 'VERKBEZ_STUECK', ), 'name' => 'Verpackungsart', 'wert' => 'Tüte', 'einheit' => array ( ), ), ), ), 7 => array ( '@attributes' => array ( 'id' => '25', ), 'name' => 'Sensorik, Beschaffenheit', 'merkmal' => array ( 0 => array ( '@attributes' => array ( 'id' => 'GESCHMACK', ), 'name' => 'Geschmack', 'wert' => 'mandelig', 'einheit' => array ( ), ), 1 => array ( '@attributes' => array ( 'id' => 'GERUCH', ), 'name' => 'Geruch', 'wert' => 'mandelig', 'einheit' => array ( ), ), 2 => array ( '@attributes' => array ( 'id' => 'KONSISTENZ', ), 'name' => 'Konsistenz', 'wert' => 'Pulver', 'einheit' => array ( ), ), ), ), ), ), 'BILD' => '/produkte/bilder/BVEG/11999.jpg', 'BILD_M' => '/produkte/bilder/BVEG/11999_medium.jpg', 'BILD_T' => '/produkte/bilder/BVEG/11999_thumb.jpg', 'BILD_I' => '/produkte/bilder/BVEG/11999_ico.jpg', 'BILD_B' => '/produkte/bilder/BVEG/11999_big.jpg', 'BARCODE' => 'http://www.ecoinform.de/produkte/bilder/barcode/4005394284278.jpg', 'PDF' => 'http://www.ecoinform.de/datenblatt/ecoinform/?key=w%9A%AB%80%9C%C9%9F%9A%A2%A9%A8%99%AF%C4%CA%CB%90%90z%A9%A5z%A4%A0', 'PG_LONGTEXT' => array ( ), 'PG_LONGTEXT_OEBO' => array ( ), 'DATENQUELLE' => array ( 'info' => ' Diese Informationen wurden von www.ecoinform.de zur Verfügung gestellt. ecoinform übernimmt keine Gewähr für die Richtigkeit der Angaben. ', 'logo' => 'http://www.ecoinform.de/images/ecoinform_thumb.jpg', ), )

0

Решение

Решение также является моей любимой особенностью array_column(), Когда вы предоставляете 2-й параметр null и назначив желаемый новый ключ в качестве 3-го параметра, вы волшебным образом получите ассоциативные отношения, которые вы вызываете, в симпатичном однострочнике без блока цикла.

$array["merkmale"]["gruppe"] = array_column($array["merkmale"]["gruppe"], null, "name");

Красиво, правда?

Вот демонстрация.

3

Другие решения

Таким образом, в основном вы хотите заменить цифровые клавиши на merkmale -> gruppe уровень с name предмета? Тогда это должно сделать:

// $data would be the variable holding your full array here
$temp = $data['merkmale']['gruppe']; // copy this sub-array to a temp. variable
$data['merkmale']['gruppe'] = []; // replace it with an empty array in the orig. structure
foreach($temp as $merkmal) { // loop over the temp array
// insert back into original data structure, using the name as key
$data['merkmale']['gruppe'][$merkmal['name']] = $merkmal;
}

print_r($data);
0

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector