Ich habe einen Post Array wie folgt:Neuformatierung des Post Array
[quantity] => Array
(
[5] => 10
[23] => 20
)
[price] => Array
(
[5] => 100.00 $
[23] => 200.00 $
)
[amount] => Array
(
[5] => 1,000.00 $
[23] => 4,000.00 $
)
5 und 23 ist ID Produkt erhalten. Und ich brauche es zu konvertieren:
[5] => Array
(
[quantity] => 10
[price] => 100.00 $
[amount] => 1,000.00 USD
)
[23] = => Array
(
[quantity] => 20
[price] => 200.00 $
[amount] => 4,000.00 USD
)
Wie kann ich dies effizient erreichen, so dass sie bereit sein für mysql einfügen?
@Repox, 'foreach ($ post wie $ input_key => $ input_values) { foreach ($ input_values as $ Feld => $ value) { $ tmp [$ field] [$ input_key] = $ value; } } 'und ehrlich gesagt funktioniert es, aber ich will nur wissen, ob es der beste Weg ist. –
@yahyaE wenn das funktioniert, sieht es gut für mich aus. – MakuraYami
Die Lösungen scheinen vernünftig - kurz und einfach. Ich mag das. – Repox