How would I do this :
10 (minus) 30%
?
Thanks!
I'm not going to give you the answer...
Hint : the simpliest way is to use a multiplication...
Yep, this much I know.
It's not like you don't get taught this in primary school...
Forget it.
Thanks?
You probably know it, but look what '%' means in PHP :
http://ca.php.net/manual/en/language.operators.arithmetic.php
Are you asking how to do this in PHP? Or the actual computation involved?
It's simple either way: x - .30x
With a few more characters, the equation becomes PHP code...
If it's so simple, why not just post the damn thing instead of belittling him? :/
$number = '10'; $percentage = '.3'; $product = $number - ($number * $percentage); echo $product;
Simply cause a good programmer must think and find solutions by himself, and in this case, anyone can do it. If we give answers to all, there won't be any more good programmers 😉
By the way, don't use quotes with integers...
nah that just means us good programmers get paid more
One less arithmetic calculation:
$product = $number * .7;
Or...
$number = 10; $percentage = 0.3; $product = $number * (1 - $percentage); echo $product;