How can I group values inside the Array and as an example, I want to get it like this
[1]=>array(
["type"] => 1
["amount"] => array(2500,200,5000,400)
)
[2]=>array(
["type"] => 2
["amount"] => array(4500,500,5000,400)
)
you can use below code for that :-
$ps = array();
$ps[]=array("type" => 1, "amount" => array(2500,200,5000,400));
$ps[]=array("type" => 2 , "amount" => array(4500,500,5000,400));
print_r($ps);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With