whalewillie Posted July 9, 2010 Share Posted July 9, 2010 Hi,how do a calculation in the loop with different interest rate? Example: for($i = 1; $i <= 6; $i++){ echo $i; } output is: 123456. But what i need is '1-3' to be calculated with interest(e.g 50% ,and also '4-6' with diff interest(100%) which the output will be 1.5, 3, 4.5, 8, 10, 12 What will be the code to compute this output? Link to comment https://forums.phpfreaks.com/topic/207244-i-need-help-in-loops/ Share on other sites More sharing options...
kumarkiranm Posted July 9, 2010 Share Posted July 9, 2010 use condition in for loop if $i <= 3 { << Calculation with 50%>> } else { << Calculation with 100% >> } Link to comment https://forums.phpfreaks.com/topic/207244-i-need-help-in-loops/#findComment-1083567 Share on other sites More sharing options...
Adam Posted July 9, 2010 Share Posted July 9, 2010 Will it always be a fixed loop of 1-6? Seems a bit of an odd siltation. Link to comment https://forums.phpfreaks.com/topic/207244-i-need-help-in-loops/#findComment-1083569 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.