I have an array
Array
(
[0] => Array
(
[order_id] => 1318
[code] => shipping
[title] => UK Shipping (Weight: 0.00kg)
[value] => 10.2000
)
[1] => Array
(
[order_id] => 1318
[code] => sub_total
[title] => Sub-Total
[value] => 4.7000
)
[2] => Array
(
[order_id] => 1318
[code] => coupon
[title] => Coupon (10P)
[value] => -0.4700
)
[3] => Array
(
[order_id] => 1318
[code] => tax
[title] => VAT (20%)
[value] => 2.8860
[sort_order] => 8
)
[4] => Array
(
[order_id] => 1318
[code] => total
[title] => Total
[value] => 17.3160
)
)
I want to swap the array index. I want to swap the array index when [code] => coupon to [code] => sub_total, If coupon is available. I want the position of coupon to above the subtotal. I want the position of sub_total to above the vat. How is it possible? Please help me.