Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

php truncate float

jules G-F answered on July 12, 2023 Popularity 3/10 Helpfulness 1/10

Contents


More Related Answers

  • php parse float 2 decimal places
  • parsefloat php
  • php truncate string
  • php float 2 decimais
  • check if number is float in php
  • php truncate string
  • php float round
  • Convert String to Float in PHP
  • float till 2 decimal points php
  • php float value
  • Convert String to Float in PHP
  • string to float php
  • difference between float and double php
  • how to convert integer to float php
  • Convert String to Float in PHP
  • php convert float
  • php get fractional part of float
  • php float to string preserve zero decimal
  • php calculate age as float
  • convert a value to a float in php
  • convert a value to a float in php
  • php ctype float

  • php truncate float

    0

    Parameters ¶

    *num*

    The value to round.

    *precision*

    The optional number of decimal digits to round to.

    If the precision is positive, num is rounded to precision significant digits after the decimal point.

    If the precision is negative, num is rounded to precision significant digits before the decimal point, i.e. to the nearest multiple of pow(10, -$precision), e.g. for a precision of -1 num is rounded to tens, for a precision of -2 to hundreds, etc.

    *mode*

    Use one of the following constants to specify the mode in which rounding occurs.

    - PHP_ROUND_HALF_UP : Rounds num away from zero when it is half way there, making 1.5 into 2 and -1.5 into -2.

    - PHP_ROUND_HALF_DOWN : Rounds num towards zero when it is half way there, making 1.5 into 1 and -1.5 into -1.

    - PHP_ROUND_HALF_EVEN : Rounds num towards the nearest even value when it is half way there, making both 1.5 and 2.5 into 2.

    - PHP_ROUND_HALF_ODD : Rounds num towards the nearest odd value when it is half way there, making 1.5 into 1 and 2.5 into 3.

    Popularity 3/10 Helpfulness 1/10 Language php
    Source: www.php.net
    Tags: php truncate
    Link to this answer
    Share Copy Link
    Contributed on Jul 12 2023
    jules G-F
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.