Home >Backend Development >PHP Tutorial >PHP float function rounding example code

PHP float function rounding example code

零下一度
零下一度Original
2017-06-23 14:40:341362browse

No rounding, only integers
floor function 2.1 = 2
2.6 = 2

Do not round floating point into 1
ceil function: 2.1 = 3
2.6 = 3
ceil(-3.14)=-3
ceil(9.99)=10

Rounding function: 2.1 = 2
2.6 = 3
round(1.9558 3, 2) =1.96

Conversion to integer

intval function 2.1 = 2
2.6 = 2
intval('abc')=0
intval('5bc')=5

The above is the detailed content of PHP float function rounding example code. 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