For example:
(a)123 / (b)1000开发者_如何学C = (c)0,123 echo c must be 0,12 How can this be done ?Use round(), sprintf() or number_format().
Examples:
<?php
$res = 123/1000;
printf('%.2f', $res);
echo round($res, 2);
echo number_format($res, 2);
?>
Use number_format http://php.net/number_format
Using sprintf() can be a way to do that.
加载中,请稍侯......
精彩评论