Round In Php W3Schools

❮ PHP. Math Reference


Bạn đang xem: Round in php w3schools

❮ PHP Math Reference


"); echo(round(0.50) . "
"); echo(round(0.49) . "
"); echo(round(-4.40) . "
"); echo(round(-4.60)); ?>

❮ PHP. Math Reference


Definition và Usage

The round() function rounds a floating-point number.

Tip: To round a number UP lớn the nearest integer, look at the ceil() function.

Tip: To round a number DOWN khổng lồ the nearest integer, look at the floor() function.

Syntax


❮ PHP Math Reference


Parameter Values

Parameter Description number Required. Specifies the value khổng lồ round precision Optional. Specifies the number of decimal digits khổng lồ round khổng lồ. Default is 0 mode Optional. Specifies a constant lớn specify the rounding mode: PHP_ROUND_HALF_UPhường - Default. Rounds number up to lớn precision decimal, when it is half way there. Rounds 1.5 khổng lồ 2 và -1.5 lớn -2 PHP_ROUND_HALF_DOWN - Round number down to precision decimal places, when it is half way there. Rounds 1.5 khổng lồ 1 & -1.5 to lớn -1 PHP_ROUND_HALF_EVEN - Round number to precision decimal places towards the next even value PHP_ROUND_HALF_ODD - Round number lớn precision decimal places towards the next odd value

Technical Details

Return Value: The rounded value Return Type: Float PHP.. Version: 4+ PHP. Changelog: PHP 5.3: The mode parameter was added

More Examples


❮ PHP Math Reference


");echo(round(7.045,2) . "
"); echo(round(7.055,2)); ?>

❮ PHPhường. Math Reference


Xem thêm: Cung Hoàng Đạo Taurus Ý Tưởng, Tính Cách Cung Kim Ngưu (Taurus)

❮ PHPhường Math Reference


"); echo(round(-1.5,0,PHP_ROUND_HALF_UP) . "
"); echo(round(1.5,0,PHP_ROUND_HALF_DOWN) . "
"); echo(round(-1.5,0,PHP_ROUND_HALF_DOWN) . "
"); echo(round(1.5,0,PHP_ROUND_HALF_EVEN) . "
"); echo(round(-1.5,0,PHP_ROUND_HALF_EVEN) . "
"); echo(round(1.5,0,PHP_ROUND_HALF_ODD) . "
"); echo(round(-1.5,0,PHP_ROUND_HALF_ODD)); ?>
Tabs Dropdowns Accordions Side Navigation Top Navigation Modal Boxes Progress Bars Parallax Login Form HTML Includes Google Maps Range Sliders Tooltips Slideshow Sort List
×

Report Error

If you want to report an error, or if you want to lớn make a suggestion, do not hesitate to lớn skết thúc us an e-mail:

help

❮ PHPhường. Math Reference


❮ PHP. Math Reference


Top Tutorials HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Pykhông lớn Tutorial W3.CSS Tutorial Bootstrap Tutorial PHPhường Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
Top References HTML Reference CSS Reference JavaScript Reference SQL Reference Pybé nhỏ Reference W3.CSS Reference Bootstrap Reference PHPhường Reference HTML Colors Java Reference Angular Reference jQuery Reference
Top Examples HTML Examples CSS Examples JavaScript Examples How To Examples Squốc lộ Examples Pybé nhỏ Examples W3.CSS Examples Bootstrap Examples PHP Examples Java Examples XML Examples jQuery Examples
Web Courses HTML Course CSS Course JavaScript Course Front End Course Squốc lộ Course Pythuôn Course PHPhường Course jQuery Course Java Course C++ Course C# Course XML Course Get Certified »
obatambeienwasirherbal.com is optimized for learning and training. Examples might be simplified lớn improve reading and learning. Tutorials, references, và examples are constantly reviewed to lớn avoid errors, but we cannot warrant full correctness of all nội dung. While using obatambeienwasirherbal.com, you agree lớn have read và accepted our terms of use, cookie and privacy policy. Copyright 1999-2021 by Refsnes Data. All Rights Reserved. obatambeienwasirherbal.com is Powered by W3.CSS.
*