I wonder how can i convert float to …
$x = 12.548544444
$x = 12.55
This reply has been reported for inappropriate content.
$x = 12.548544444;<br />
$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.
thx very much for helping me
You must be logged in to reply to this topic.