I've got an array of variable size wich is going to contain items
Array
(
[0] => Array
(
[id] => 126264027457298
[qty] => 6
[price] => 55.85
[shipping] => 6.00
[fbids] => 12
[imgids] => 126264027457298
[albids] => 126263974123970
[thumbs] => https://268088_126264027457298_100002211034371_220013_7172874_n.jpg
[infos] => This is the product name of Item 1
[subtotal] => 371.1
)
[1] => Array
(
[id] => 126265084123859
[qty] => 6
[price] => 25.85
[shipping] => 6.00
[fbids] => 11
[imgids] => 126265084123859
[albids] => 126263974123970
[thumbs] => https://261288_126265084123859_100002211034371_220039_5639038_n.jpg
[infos] => This is the product name of Item 2
[subtotal] => 191.1
)
)
And I would like to take part of this array ([qty],[price],[infos]) for each items (no matter of few or many there are) and add it to another array which is formed as follow:
Array
(
[cmd] => _cart
[upload] => 1
[business] => [email protected]
[return] => http://www.mysite.com/paypal/return.php
[cancel_return] => http://www.mysite.com/paypal/cancel.php
[currency_code] => EUR
[lc] => FR
)
The result should look like shown below, so for each item that is going to be added to the array, [item_name_X], [quantity_X] and [amount_X] should increase.
Array
(
[cmd] => _cart
[upload] => 1
[business] => [email protected]
[return] => http://www.mysite.com/paypal/return.php
[cancel_return] => http://www.mysite.com/paypal/cancel.php
[currency_code] => EUR
[lc] => FR
[item_name_1] => This is the product name of Item 1
[quantity_1] => 6
[amount_1] => 55.85
[item_name_2] => This is the product name of Item 2
[quantity_2] => 6
[amount_2] => 25.85
)
quantity_Xitems back into an array.