Math Round In PHP

In this article I am going to explain PHP math round function.
  • 1659

Introduction

It rounds a number to the nearest integer.

Syntax

round  (number, round decimal)

 

Parameters in Round function

It has two parameters; they are:
 

Parameter Description
number The no to be round and it is required parameter.
round decimal It is optional parameter and specifies number of digests after the decimal point.

Example of Round function

<?
php

echo ("Round of (0.70)  is:  " .round(0.70)."</br>");

echo ("Round of (0.40)  is:  " .round(0.40)."</br>");

echo ("Round of (13,5)  is:  " .round(13,5)."</br>");

echo ("Round of (-0.70)  is: " .round(-0.70)."</br>");

echo ("Round of (3.37)  is:  " .round(3.37)."</br>");

?>

Output

math-roundfunction-in-php.jpg

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.