Home  >  Article  >  Backend Development  >  How to use php round function

How to use php round function

藏色散人
藏色散人Original
2019-01-30 10:27:567394browse

PHP round() function is used to round floating point numbers. The round syntax is round(X,prec), the parameter X represents the number to be processed, and prec represents the number of digits after the decimal point.

How to use php round function

#How to use the round() function?

Function: The function of round() function is to round floating point numbers

Syntax:

round(X,prec)

Parameters:

X means to do The processed number

prec represents the number of digits after the specified decimal point

Description: Returns the result of rounding the parameter 0 is the default value.

php round() function usage example 1:

Output:

1.56*****10*****-5

php round() function usage example 2:

Output:

-6

This article is an introduction to the PHP round function. I hope it will be helpful to friends in need!

The above is the detailed content of How to use php round function. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn