Synergic Posted September 30, 2006 Share Posted September 30, 2006 i don't know why the following isn't working. I'm trying to calculate 10% of a value?[code]$a = 10/100;$b = 0;$b = $a*$b;echo $b;[/code]it just gives me 0 :| Link to comment https://forums.phpfreaks.com/topic/22574-calculating-percentages/ Share on other sites More sharing options...
extrovertive Posted September 30, 2006 Share Posted September 30, 2006 Remember in pre-school A*0 = 0? Anything times zero becomes 0 right?$val = (val);$newval = $val - (.10*$val); Link to comment https://forums.phpfreaks.com/topic/22574-calculating-percentages/#findComment-101292 Share on other sites More sharing options...
Synergic Posted September 30, 2006 Author Share Posted September 30, 2006 heh whoops yes it works now:[code]$a = 10/100; $b = 1000; $b = $a*$b; echo $b;[/code] Link to comment https://forums.phpfreaks.com/topic/22574-calculating-percentages/#findComment-101294 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.