this is my array now but I don't want like this
array:36 [▼
"pentrose_50_rafhan_c_kgs" => 100
"pentrose_50_rafhan_c_issued_kgs" => 300
"pentrose_50_rafhan_c_rskg" => 99.1
"pentrose_50_rafhan_c_amount" => 29730
]
This is my code:
foreach (array_combine($result, $filterred_chemical_keys) as $key => $chemical) {
$arr = explode('_c_', $key);
// dd($arr);
$result[array_shift($arr)] = $arr;
}
dd($result);
Please help to make array like this
array:36 [▼
"pentrose_50_rafhan" => [
"kgs" => 100
"issued_kgs" => 300
"rskg" => 99.1
"amount" => 29730
]
]
I just explode via _c_
and make key parent and other keys as a child. I have tried many things like array_shift
but nothing works for me.
Any help, please?