programming-examples/php/Math/PHP script which rounds the following values with 1 decimal digit precision..php

5 lines
180 B
PHP
Raw Permalink Normal View History

2019-11-15 12:59:38 +01:00
<?php
echo round( 1.65, 1, PHP_ROUND_HALF_UP)."\n"; // 1.7
echo round( 1.65, 1, PHP_ROUND_HALF_DOWN)."\n"; // 1.6
echo round(-1.54, 1, PHP_ROUND_HALF_EVEN)."\n"; // -1.5
?>