PHP floating point number rounding rounding

WBOY
Release: 2016-07-28 08:27:52
Original
1489 people have browsed it
<?php
 $a = 1.1;
 $b = 3.9;

 //取整数部分
 echo floor($a);	// 1
 echo floor($b);	// 3

 // 进一取整
 echo ceil($a);		// 2
 echo ceil($b);		// 4

 // 四舍五入
 echo round($a);	// 1
 echo round($b);	// 4
?>
Copy after login

The above has introduced PHP floating point number rounding, rounding, and rounding, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!