I wonder how can i convert float to ...
$x = 12.548544444 to $x = 12.55
$x = 12.548544444; $answer = round($x*100); $answer = $answer/100; // $answer == 12.55
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
thx very much for helping me
I wonder how can i convert float to ...
$x = 12.548544444
to $x = 12.55
This can be reduced to a single operation by passing a 2nd argument to the round() function.
The "2" tells it to round two places past the decimal.
http://php.net/manual/en/function.round.php
thx very much for helping me