PHP does not have integer division
such as: 2/5=0.4 and not 2/5=0
Although the bottom of PHP is the use of C language implementation, but really pay attention to this pit, especially some of the details of the calculation, remember to remember!
'
This article mainly introduces the use of truth division and Floor Division in Python3, and analyzes the differences between truth division and Floor division based on the instance form, if you need it, refer to the example in this article to
This article analyzes the usage differences between floating-point (float) and integer (integer) data types in PHP and, in that case, insufficient data lengths.
The value can only be true or false, and when other types are converted to Boolean, the
This article analyzes the differences between float and integer Data Types in php and the insufficient data length in that case.
The value can only be True or False. When other types are converted to the boolean type, the following values are
An integer is a number in the collection ℤ= {..., 2,-1, 0, 1, 2, ...}.
Grammar
Integer values can be expressed in decimal, hexadecimal, octal, or binary notation, preceded by an optional symbol (-or +).
The binary representation of the integer is
The integer value can be in decimal, hexadecimal, octal, or binary format. an optional symbol (-or +) can be added before ). Integer expressed in binary format is available from PHP5.4.0. An integer is a number in the set period = {...,-2,-1, 0, 1, 2
PHP is actually a small value in addition to www.zhixing123.cnphp27277.html. if we use the 'operator to perform division operations, we will get a small value if we cannot perform division operations. What if I only want to get the integer part?
How PHP implements the entire division. What if I only want to get the integer part? Multiple functions are provided in the PHP mathematical function library for PHP to implement division.
Http://www.zhixing123.cn/php/27277.html
If we use the '/'
In php, the division method (round, ceil, floor) and ceilfloor
In PHP, you need to use the following method to get the result of division:
1. round: Rounding
The round () function rounds a floating point number.
Syntax: round (x, prec)
If we use the "/" operator for division, we get a decimal value if we encounter a situation that cannot be done. What if I only want to get the integer part?1.round-rounding of floating-point numbersFloat round (float $val [, int $precision])
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.