What is the integer data type? The integer data type is what we often call integers. It can only be integers. For example, we have written 123456, my age is 20, which is an integer, or -123456, which is both Represents the integer type. We write these in decimal. We can also write octal and hexadecimal numbers, which all represent the integer type. If you use octal representation, you must add 0 in front of the number. If you use hexadecimal, you need to add 0x. The integer type must have a valid range. The valid range is -2447483648~+2147483647. Now that there is a storage range, let’s talk now Is the addition of two integers equal to an integer? Not necessarily, because exceeding the storage range of integers will produce a phenomenon called overflow. What does it mean? Let us say, take a one-liter cup, you want If you want to hold ten liters of water, it won’t be able to hold it and it will leak out. So if you want to hold ten liters of water, you can only use a larger container to hold it. Therefore, when the given value exceeds the maximum range that the int type can express, it will be treated as a float type. The storage range of the floating point type is larger than that of the integer type. If illegal numbers (8 and 9) appear in octal, the following numbers will be
1. php: Detailed explanation of integer data type examples
Introduction: The integer data type is what we often call integers. It can only be integers. Like we wrote 123456, I The age is 20, which is an integer type, or -123456, which all represent integer types. We write these in decimal, and we can also write octal and hexadecimal numbers, which all represent integers. If you use octal representation, you must add 0 in front of the number. If you use hexadecimal, you need to add 0x.
2. Parsing the integer type of PHP data type (Integer)
Introduction: An integer is the set ℤ={...,-2,-1,0, A number among 1,2,...}. Syntax Integer values can be expressed in decimal, hexadecimal, octal or binary, and can be preceded by an optional sign (- or +). ...
Introduction: Integer values can be represented in decimal, hexadecimal, octal or binary, and can be preceded by an optional symbol (- or +). Binary expressed integer is available since PHP 5.4.0.
4. Data types in PHP (1)_PHP tutorial
Introduction: Data types in PHP ( 1). PHP supports eight primitive types. Four scalar types: boolean, integer, float (floating point number, also called "double"), string, two types
5. PHP supports 8 primitive types
Introduction: PHP supports 8 primitive types PHP supports eight primitive types. Four scalar types: boolean - true or fasle Both are case-insensitive integers (integer) - 32-bit system, range: -2 147 483 648 ~ +2 147 483 647 floating point Type (float) (floating point number, also called "double") - 32-bit system, range: 1.7E-308~
6. PHP supports 8 primitive types
Introduction: PHP supports eight primitive types PHP supports eight primitive types. Four scalar types: boolean - true or fasle Both are case-insensitive integers (integer) - 32-bit system, range: -2 147 483 648 ~ +2 147 483 647 floating point Type (float) (floating point number, also called "double") - 32-bit system, range: 1.7E-308~1
Introduction: Data types in PHP (1). PHP supports eight primitive types. Four scalar types: boolean, integer, float (floating point number, also called "double"), string, two types
[Related Q&A recommendations]:
The above is the detailed content of Summarize the points to note about integer (Integer). For more information, please follow other related articles on the PHP Chinese website!