- round: documentation ( source)
- print_r: documentation ( source)
- floor: documentation ( source)
- ceil: documentation ( source)
- array_fill: documentation ( source)
<?php
$amount = 320.49;
$payments = array_fill(0, 3, floor($amount * 100 / 4) / 100);
$payments[3] = round($amount - $payments[0] * 3, 2);
print_r($payments);
$payments = array_fill(0, 3, ceil($amount * 100 / 4) / 100);
$payments[3] = round($amount - $payments[0] * 3, 2);
print_r($payments);