Results 1 to 10 of 10

Thread: [RESOLVED] PHP Math Functions

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2008
    Location
    >> ( ҉ )
    Posts
    413

    Resolved [RESOLVED] PHP Math Functions

    Amount: Something - Something = 407325.96875

    How do i can make this function => ~
    I don't know what is it, but i want ~ the amount of items for being answer without 10239293(.29383)

    Thanks.

  2. #2
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: PHP Math Functions

    you mean round 407325.96875 to a whole number? sorry i don't really get what you mean..

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2008
    Location
    >> ( ҉ )
    Posts
    413

    Re: PHP Math Functions

    Yes i want it to be number without . between numbers it should say ~407326 without .96875

  4. #4
    Frenzied Member
    Join Date
    Apr 2009
    Location
    CA, USA
    Posts
    1,516

    Re: PHP Math Functions

    I'm not sure I get what you mean either, but you might be looking for the floor() function - it rounds down to a whole number.

  5. #5
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: PHP Math Functions

    or the round() function to round either down or up. or typecast it to being an int so that it autmatically removes decimal places.

    PHP Code:
    $var = (int) 30223424.24234234

  6. #6
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: PHP Math Functions

    i'm sure he wants to round from the separator into a whole number... if he got 40.546 the number will turn into 41 or if its 40.3 it will turn into 40... if thats what he wants then this might help: http://php.net/manual/en/function.round.php
    Code:
    <?php
    $var1 = "1534.4";
    echo round($var1);
    ?>

  7. #7
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: PHP Math Functions

    uh, yeah, I mentioned that in my post already..

  8. #8
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: PHP Math Functions

    oh sorry didn't really read you post...

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    May 2008
    Location
    >> ( ҉ )
    Posts
    413

    Re: PHP Math Functions

    Thanks. Any suggestions for?: <?php $NormalTree = 13034431 - $_GET[Experience];
    echo $NormalTree / 25 ?>

  10. #10
    Frenzied Member
    Join Date
    Apr 2009
    Location
    CA, USA
    Posts
    1,516

    Re: PHP Math Functions

    Code:
    <?php $NormalTree = 13034431 - $_GET[Experience];
    echo round($NormalTree / 25); ?>

Posting Permissions

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



Click Here to Expand Forum to Full Width