- Forums
- PHP
- How To Round Numbers To The Nearest
This Short Tutorial Will Try To Show You How You Can Round A Number To The Nearest Teth Hundreths Thousands Millions [2061], Last Updated: Mon Jun 24, 2024
Webune Tutorials
Thu Nov 05, 2009
0 Comments
307 Visits
Hello,
Welcome to Webune Support Forums.
We know that as a PHP developer, its nice sometimes to have excellent support from your web hosting provider.
that is why we are writing this short tutorial to help you round numbers.
for example, lets say i have a integer (number) and the value of of the integer is 956.562 for the price of a software.
but i only want to show the price in cents like this: 956.56
so all you have to do is use this formula
PHP CODE
<?PHP
$value = 956.326;
echo round($value,2);
?>
OUTPUT:
956.33