I wrote a code which will get the monthly amortization of customer and the balance of customer's total payment excluding the customer monthly amortization. My problem is how do I insert the result into another array?
$remaining = 12200;
$amort = 5742;
for($remaining += $amort;
$remaining > $amort;
($result[] = ($remaining-=$amort) < $amort ? $remaining : $amort)
);
print_r($result);
Here's the result
Array ( [0] => 5742 [1] => 5742 [2] => 716 )
And, I want to insert the $result array into another group of array, Here's my code.
$data4[] = array('collection_payment'=>$result);
the result of $data4 will be the one to insert in database mysql, so if you print the $data4, this will be the result,
Array ( [collection_payment] => 5742 [collection_payment] => 5742 [collection_payment] => 716 )
Any ideas?