In PHP, the round () function rounds a floating point number. In PHP, the round () function rounds a floating point number. in this article, the round () function rounds a floating point number. The round () function in PHP is used to round the
This article mainly introduces how the round () function in PHP rounds floating-point numbers. It summarizes various common usage of the round () function through detailed examples, it is a very practical technique. If you need it, you can refer to
This article mainly introduces how the round () function in PHP rounds floating-point numbers. it summarizes various common usage of the round () function through detailed examples, it is a very practical technique. if you need it, you can refer to
This example describes how the round () function in PHP rounds the floating-point numbers. Share to everyone for your reference. The specific methods are as follows:
Syntax: Round (X,PREC)
Parameters
Describe
X
SyntaxRound (x, prec) parameter descriptionX is optional. Specifies the number to be rounded.Prec is optional. Specifies the number of digits after the decimal point.
DescriptionReturns the result of rounding x to the specified precision prec
SyntaxRound (x, prec) parameter descriptionX is optional. Specifies the number to be rounded.Prec is optional. Specifies the number of digits after the decimal point.DescriptionReturns the result of rounding x to the specified precision prec (number
Php_ keep two decimal places and round _ Keep two decimal places and do not round
php reserved Two decimal places and rounded
$num = 123213.666666;echo sprintf ("%.2f", $num);
PHP retains two decimal places and does not round
$num = 123213.666
This article is the official HTML5 training course for h5edu institutions, mainly introduces: JavaScript intensive tutorial--javascript Math (Arithmetic) object The function of the Math object is: Perform common arithmetic tasks. Round () How to use
Ceil is a function for getting a value from the up position; floor is a function for rounding out the decimal places to get a value; round is a function for rounding out. Ceil definition and usage: the ceil () function rounds up to the nearest
Example of PHP rounding, rounding, and using the round function. Example of using the PHP rounding, rounding, and round functions, and rounding the round decimal places: PHP keeps two decimal places and rounds them to copy the code as follows: $ n0.1
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.