Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php round function Passing parameters with mode.

<?php
// round to nearest even value
echo(round(10.5,0,PHP_ROUND_HALF_EVEN));
echo "<br>";
 
// round to nearest odd value
echo(round(10.5,0,PHP_ROUND_HALF_ODD));
echo "<br>";
 
// round towards zero
echo(round(10.5,0,PHP_ROUND_HALF_DOWN));
echo "<br>";
 
// round away from zero
echo(round(10.5,0,PHP_ROUND_HALF_UP));
?>
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #php #function #Passing #parameters
ADD COMMENT
Topic
Name
2+1 =