tsilenzio Posted July 15, 2008 Share Posted July 15, 2008 whenever I run this script the number never exceeds 253,000,000 If i change ethier one of these vairables $startInvest Or $days The script stops and displays results when $currInvest is greater then 253,000,000. How would i fix this so the script goes, I need the numbers to be as big as 1,000,000,000,000 about, bigger if possible <?php $percent[0] = 0.9; $percent[1] = 1.0; $percent[2] = 1.1; $percent[3] = 1.2; $percent[4] = 1.3; $minrange[0] = 1000000; $minrange[1] = 10000000; $minrange[2] = 50000000; $minrange[3] = 100000000; $minrange[4] = 250000000; $maxrange[0] = 9999999; $maxrange[1] = 49999999; $maxrange[2] = 99999999; $maxrange[3] = 249999999; $maxrange[4] = 0; $startInvest = 10000000; $weeklyDeposit = 500000; $currInvest = $startInvest; $days = 280; $startPercent = 0; $endPercent = 0; $lastIncrease = 0; // Loop thru all days for($i = 1; $i < $days + 1; $i++) { if($i == 1) { echo("<table cellspacing=\"5\">\n<tr align=\"right\">\n<td><b>Day</b></td>"); echo("\n<td align=\"center\"><b>Investment</b></td align=\"right\">\n<td><b>Percent</b></td>"); echo("\n<td align=\"center\"><b>Daily Interest</b></td>\n"); echo("\n<td align=\"center\"><b>Deposit Increase</b></td>\n</tr>"); } // Test each array element for($j = 0; $j < count($percent); $j++) { // See where the current investment fits into if(($currInvest >= $minrange[$j]) && ($currInvest <= $maxrange[$j])) { $lastIncrease = $currInvest; $currInvest *= (($percent[$j] / 100) + 1); $lastIncrease = $currInvest - $lastIncrease; echo("<tr><td align=\"right\">" . number_format($i) . "</td>\n"); echo("<td align=\"right\">$" . number_format($currInvest) . "</td>\n"); echo("<td align=\"right\">" . number_format($percent[$j], 1) . "%</td>"); echo("<td align=\"right\">$" . number_format($lastIncrease) . "</td>"); if(($i % 7 == 0) && ($weeklyDeposit > 100000)) { $currInvest += $weeklyDeposit; echo("<td align=\"right\">\$" . number_format($weeklyDeposit) . "</td></tr>"); } else { echo("<td align=\"right\">$0</td></tr>"); } } } if($i == $days) { echo("\n</tr>\n</table>"); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/114861-integer-size-problem-cuts-off/ Share on other sites More sharing options...
MadTechie Posted July 15, 2008 Share Posted July 15, 2008 this may help http://uk3.php.net/manual/en/language.types.integer.php see Integer overflow section Quote Link to comment https://forums.phpfreaks.com/topic/114861-integer-size-problem-cuts-off/#findComment-590674 Share on other sites More sharing options...
tsilenzio Posted July 15, 2008 Author Share Posted July 15, 2008 So i would have to do var_dump($value); ? Quote Link to comment https://forums.phpfreaks.com/topic/114861-integer-size-problem-cuts-off/#findComment-590678 Share on other sites More sharing options...
MadTechie Posted July 15, 2008 Share Posted July 15, 2008 it doesn't say that! it basically says Integers over 2,147,483,647 become floats.. but reviewing your code in don't see any integer based problems! Quote Link to comment https://forums.phpfreaks.com/topic/114861-integer-size-problem-cuts-off/#findComment-590695 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.