php calculations
<pre><code>1 - 165.25
2 - 165.25
3 - 165.25
4 - 165.25
5 - 165.25
6 - 165.25
7 - 165.25
8 - 165.25
9 - 165.25
10 - 165.25
</code></pre>

<p>How to calculate .25 from all 10 amounts (0.25x10) = 2.5 and add that amount to the last value like this:</p>

<pre><code>1 - 165
2 - 165
3 - 165
4 - 165
5 - 165
6 - 165
7 - 165
8 - 165
9 - 165
10 - 167.5
</code></pre>

<p>code</p>

<pre><code>$amount = 165.25; // can be any number
    $periods = 10; // can be from 1 to 100;

for($i=1;$i&lt;=$periods;$i++){
echo $i. ' - '.$amount."&lt;br /&gt;";
}
</code></pre>

<p>UPDATE Working example:</p>

<pre><code>$amount = 165.25; // can be any number
$periods = 10; // can be from 1 to 100;

$z = 0;
for($i=1;$i&lt;=$periods;$i++){

    $e = explode(".", $amount);

    $z += $e[1] / 100;

    if($i == $periods){
        $e[0] += $z;
    }

echo $i. ' - '.$e[0]."&lt;br /&gt;";
}
</code></pre>

<p>I don't like explode part any alternatives ?</p>
