Forums

Give help. Get help.

  • # January 9, 2013 at 3:16 am

    I wonder how can i convert float to …

    $x = 12.548544444
    to
    $x = 12.55

    # January 9, 2013 at 5:45 am

    This can be reduced to a single operation by passing a 2nd argument to the round() function.

    $x = 12.548544444;
    $x = round($x, 2);

    The “2” tells it to round two places past the decimal.

    http://php.net/manual/en/function.round.php

    # January 9, 2013 at 6:07 am

    thx very much for helping me

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag