monkeybidz Posted October 19, 2007 Share Posted October 19, 2007 I need to devide $var1 by 100? $insurance_fee_calc = $var1/100 ; And then multiply $insurance_fee_calc times $com_fee $insurance_fee = $insurance_fee_calc x $com_fee ; Can someone verify the code? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/73902-solved-math-division-and-multiplication-verification/ Share on other sites More sharing options...
trq Posted October 19, 2007 Share Posted October 19, 2007 $insurance_fee = ($var/100) * $com_fee; Link to comment https://forums.phpfreaks.com/topic/73902-solved-math-division-and-multiplication-verification/#findComment-372907 Share on other sites More sharing options...
darkfreaks Posted October 19, 2007 Share Posted October 19, 2007 ah damn i was baout to correct it Link to comment https://forums.phpfreaks.com/topic/73902-solved-math-division-and-multiplication-verification/#findComment-372908 Share on other sites More sharing options...
monkeybidz Posted October 19, 2007 Author Share Posted October 19, 2007 I am getting 0.12 as an answer. $var1 = 20000.00; $com_fee = 0.60; $var1 devided by 100 = 200 200 X 0.60 = 120.00 Link to comment https://forums.phpfreaks.com/topic/73902-solved-math-division-and-multiplication-verification/#findComment-372972 Share on other sites More sharing options...
darkfreaks Posted October 19, 2007 Share Posted October 19, 2007 whats the right answer sposed to be? ??? Link to comment https://forums.phpfreaks.com/topic/73902-solved-math-division-and-multiplication-verification/#findComment-372980 Share on other sites More sharing options...
monkeybidz Posted October 19, 2007 Author Share Posted October 19, 2007 removed this from the top of page and moved it after the calculation. $var1 = number_format($var1, 2); It was adding decimals to the calculation. Thanks guys! Link to comment https://forums.phpfreaks.com/topic/73902-solved-math-division-and-multiplication-verification/#findComment-372982 Share on other sites More sharing options...
monkeybidz Posted October 19, 2007 Author Share Posted October 19, 2007 120.00 Link to comment https://forums.phpfreaks.com/topic/73902-solved-math-division-and-multiplication-verification/#findComment-372983 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.