Example of how to use the round () function in PHP
The round() function, returns the rounded value of val to specified precision (number of digits after the decimal point). Precision can also be negative or zero (default).
The following example shows how to get the rounded value of pi.
<?php
$pi = pi();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PHP round test</title>
</head>
<body>
<div id="container" style="text-align: center;">
<?php
echo round($pi);
echo "<br />";
echo round($pi, 1);
echo "<br />";
echo round($pi, 2);
echo "<br />";
echo round($pi, 4);
echo "<br />";
echo round($pi, 6);
echo "<br />";
?>
</div>
</body>
</html>