How to use php round function

藏色散人
Release: 2023-04-04 22:12:02
Original
7370 people have browsed it

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)
Copy after login

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:

Copy after login

Output:

1.56*****10*****-5
Copy after login

php round() function usage example 2:

Copy after login

Output:

-6
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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 [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!