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

PHP float function rounding example code

零下一度
Release: 2023-03-10 17:38:02
Original
1374 people have browsed it

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!

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 admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template