i have an array that the middle part change according to quantity products
Array ( [name] => Alberto [email] => email@hotmail.com [code_1] => tshirt [description_1] => Tshirt color red [price_1] => 453.0 [quantity_1] => 1 [subtotal_1] => 453.0 [code_2] => sweater [description_2] => Sweater with long sleeves [price_2] => 23.43 [quantity_2] => 2 [subtotal_2] => 46.86 [employee] => 1 [total] => 499.86 )
And i want to remove the first 2 elements and the last 2 elements, just leave
Array ( [code_1] => tshirt [description_1] => Tshirt color red [price_1] => 453.0 [quantity_1] => 1 [subtotal_1] => 453.0 [code_2] => sweater [description_2] => Sweater with long sleeves [price_2] => 23.43 [quantity_2] => 2 [subtotal_2] => 46.86 )
I try with
array_splice($_POST, 2, -2);
but this just keep the first 2 and last 2, I need the elements between them.
Thanks for your help :)