Shadowing Posted June 17, 2012 Share Posted June 17, 2012 Hey guys im having a problem. This is crazy makes no sense at all. I am so stuck and out of answers on why this is happening I wrote this code out so anyone can just copy and paste it to see results $resource1_level_costs = 0; $resource1_highest_level = 2 + 1; $resource1_subtract = 50; $before_bonus_reduction = ''; while($resource1_level_costs < $resource1_subtract) { $before_bonus_reduction = pow($resource1_highest_level,3); $resource1_level_costs += ceil($before_bonus_reduction - ($before_bonus_reduction * .22)); $resource1_subtract -= $resource1_level_costs; ++$resource1_highest_level; echo $before_bonus_reduction." before deduction<br />"; echo $resource1_level_costs." after deduction<br />"; } The return is this 27 before deduction 22 after deduction 64 before deduction 72 after deduction takes 27 subtracts 22 percent giving 22 takes 64 subtracts 22 percent giving 72????? what the heck Quote Link to comment https://forums.phpfreaks.com/topic/264338-this-is-a-impossible-return/ Share on other sites More sharing options...
Shadowing Posted June 17, 2012 Author Share Posted June 17, 2012 lol nevermind, walked away from the computer for a minute and realize that is correct Quote Link to comment https://forums.phpfreaks.com/topic/264338-this-is-a-impossible-return/#findComment-1354632 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.