Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2006
    Location
    Scotland
    Posts
    1,012
    Tokens
    175

    Latest Awards:

    Default PHP Help. Returning a value to 2 decimal places.

    Ok.

    Im coding a script and after you order it adds on 17.5% VAT. But this causes problems and gives out a number. Something like $29.36325 when it should be $29.36

    PHP Code:
    $vat 24.99 100 17.5;

    $gt $vat 24.99;

    echo (
    "You ordered $_POST[iname]. The price is $24.99 (excluding VAT).  The grand total is $$gt "); 
    Thats the code im using. If anybody could help me it'd be great. I tried a few codes but nothing so far has worked.


    You don't like me
    Chances are I don't like you.

  2. #2
    Join Date
    Nov 2004
    Location
    HabboWeb FM Offices
    Posts
    3,019
    Tokens
    0

    Latest Awards:

    Default

    Display it as a image for some reason then add into it imagechar so it limits the text to about 20 so it misses out the other bits.

  3. #3
    Join Date
    Dec 2005
    Location
    Australia
    Posts
    693
    Tokens
    0

    Default

    round();

    ...
    XHTML, CSS, AJAX, JS, php, MySQL.

    --

    HxF moderators can't read timestamps.

  4. #4
    Join Date
    Oct 2005
    Location
    Melbourne, Australia
    Posts
    7,554
    Tokens
    0

    Latest Awards:

    Default

    it should end up like:

    PHP Code:
    $vat 24.99 100 17.5;

    $gt $vat 24.99;

    echo (
    "You ordered $_POST[iname]. The price is $24.99 (excluding VAT).  The grand total is $");
    echo 
    round ($gt2); 

  5. #5
    Join Date
    Mar 2006
    Location
    Scotland
    Posts
    1,012
    Tokens
    175

    Latest Awards:

    Default

    Thanks all. I tried the round function but it didn't work. If anyone needs this use the money_format() function.


    You don't like me
    Chances are I don't like you.

Posting Permissions

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