Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    New Coder
    Join Date
    Jun 2012
    Posts
    21
    Thanks
    3
    Thanked 3 Times in 3 Posts
    Corrected by replacing str_replace('-', '', $percent) with money_format('%n', $percent)

    Try this vernk:
    PHP Code:
     $percent = ($row4[2] - $row4[3]) * (100 $row4[3]);
            echo 
    '<p><s>$'.$row4[2].'</s> $'.$row4[3].' ('.round(money_format('%n',$percent)).'% off)</p>'
    Thanks to Fou-Lu for the enlightenment

  2. #17
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,535
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Quote Originally Posted by Ducklz View Post
    PHP Code:
    round(money_format('%n',$percent)).% off
    Again, no... money_format returns a string... you can't round it. And if you're interested in a percentage, why use a function designed for money formats, when you have number_format instead? There's just no point in using the formatting in this case at all. Fou-Lu was NOT using money_format for the percentage, but for the two money formatted numbers before it in his example.

  3. #18
    New Coder
    Join Date
    Jun 2012
    Posts
    21
    Thanks
    3
    Thanked 3 Times in 3 Posts
    Ok so I've had a play around (This has probably gone a bit far)

    Would this then be more appropriate?
    PHP Code:
        $val1 money_format('%n',$row4[3]);
        
    $val2 money_format('%n',$row4[2]);
        
    $percent number_format(($val1 $val2) * (100 $val1)); 
        echo 
    '<p><s>$'.$val1.'</s> $'.$val2.' ('.$percent.'% off)</p>'

  4. #19
    Regular Coder
    Join Date
    Oct 2011
    Posts
    113
    Thanks
    9
    Thanked 1 Time in 1 Post
    Haha , guys I got it fixed thanks for your help :P


 
Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •