Easy one but never done it before..

Discussion in 'PHP' started by adamjblakey, May 10, 2007.

  1. #1
    Hi,

    What i want to do is take a percentage from a total.

    Basically something like this:

    
    <?php
     $subtotal = '50';
     $discount = '10%';
     $total = ($subtotal - $discount);
    
    
    Code (markup):
    Cheers,
    Adam
     
    adamjblakey, May 10, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    $subtotal = '100';
    $discount = '10';
    
    $total = ($discount * $subtotal) / 100;
    
    PHP:
     
    nico_swd, May 10, 2007 IP
  3. adamjblakey

    adamjblakey Active Member

    Messages:
    1,121
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    80
    #3
    Thanks again nico.. Your a star :)
     
    adamjblakey, May 10, 2007 IP