php round to 5 decimal places code example
Example 1: php round decimal
$value = 1.23456789;
$rounded_value = round($value, 2);
Example 2: php round to whole number
$int = 8.998988776636;
round($int)
$int = 8.344473773737377474;
round($int)
Example 3: php round up
echo(ceil(0.60) . "<br>");
Example 4: php 2 decimal places without rounding
<?php
function cutAfterDot($number, $afterDot = 2){
$a = $number * pow(10, $afterDot);
$b = floor($a);
$c = pow(10, $afterDot);
echo "a $a, b $b, c $c<br/>";
return $b/$c ;
}
echo cutAfterDot(2.05,2);
?>