1$value = 1.23456789;
2$rounded_value = round($value, 2);
3// 2 is the precision here we will get 1.23
1// using round() function we can roundoff float values in php
2$value = 58.24365;
3round($value, 2);
4//result 58.24
1<?php
2function cutAfterDot($number, $afterDot = 2){
3$a = $number * pow(10, $afterDot);
4$b = floor($a);
5$c = pow(10, $afterDot);
6echo "a $a, b $b, c $c<br/>";
7return $b/$c ;
8}
9echo cutAfterDot(2.05,2);
10
11/*
12output = a 205, b 204, c 100
132.04
14*/
15
16?>