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 :| Quote Link to comment 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); Quote Link to comment 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] Quote Link to comment 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.