1

My screen shot on my project result I have a working IRR class but when i try using loop to create an array there is something different. when i input array manualy everything looks fine but when i use my while code Warning: Division by zero show up. i dont know where is the different betwen my manual array and while array. after i try to print those two value, the value is exacly the same. Thanks for your help``

Here is my code

$arrayIRR="";
$x=1;
while($x <= $row) {
    if ($x<$row){
        $varkoma =","; 

    }
    else ($varkoma = "");
   $arrayIRR = $arrayIRR.$varAngsuran.$varkoma;
   $x++;

}
echo "<br>";
echo "Array: ".$arrayIRR;
echo "<br>";
echo "Array: 1725000,1725000,1725000,1725000,1725000,1725000,1725000,1725000,1725000,1725000,1725000,1725000";
echo "<br>";
//echo $varPreIRR=100*12*IRRHelper::IRR(array($varNPlafon,$arrayIRR));
echo "Nilai IRR :" ;

echo IRRHelper::IRR(array(-18000000,1725000,1725000,1725000,1725000,1725000,1725000,1725000,1725000,1725000,1725000,1725000,1725000));
echo "<br>";
echo "Nilai IRR :" ;
echo IRRHelper::IRR(array(-18000000,$arrayIRR));
  • What's the result of the array you generate? `var_dump();` it – Naruto Mar 11 '16 at 09:52
  • "1725000,1725000,1725000,1725000,1725000,1725000,1725000,1725000,1725000,1725000,1725000,1725000" Those value is the result of my array. The first IRRHelper with manual input are sucsess but the next one come up with warning division by zero. – Dicky Alfians Mar 11 '16 at 10:01

0 Answers0