У меня есть массив из цикла foreach, как это:
Array (
[id] => 2
[qty] => 1
[price] => 130000
[name] => 0002/PNBP/411971/1/02/18
)
Array (
[id] => 3
[qty] => 1
[price] => 120000
[name] => 0003/PNBP/411971/1/02/18
)
Array (
[id] => 4
[qty] => 1
[price] => 150000
[name] => 0004/PNBP/411971/1/02/18
)
Я хочу вставить массив данных в массив, как это:
Array(
Array (
[id] => 2
[qty] => 1
[price] => 130000
[name] => 0002/PNBP/411971/1/02/18
),
Array (
[id] => 3
[qty] => 1
[price] => 120000
[name] => 0003/PNBP/411971/1/02/18
),
Array (
[id] => 4
[qty] => 1
[price] => 150000
[name] => 0004/PNBP/411971/1/02/18
)
);
Я пытаюсь и код, как это:
$data = array();
foreach ($_POST['id_kuitansi'] as $id_kuitansi){
$detail_kuitansi = $this->kuitansi_model->detail($id_kuitansi);
$i = $this->input;
$data = array(
'id' => $id_kuitansi,
'qty' => '1',
'price' => $detail_kuitansi['nilai'],
'name' => $detail_kuitansi['no_kuitansi']
);
print_r($data);
//$this->cart->insert($data);
}