I'm not going to give you the answer...

Hint : the simpliest way is to use a multiplication...

    It's not like you don't get taught this in primary school...

      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...

        8 months later

        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;
        
          5 days later

          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; 
                  Write a Reply...