The integer data type is an integer that we often call. it can only be an integer. for example, if we write 123456, my age is 20. this is an integer or-123456, which indicates an integer, all of these are written in decimal format. you can also write octal numbers and hexadecimal values, which all represent integer types. If octal notation is used, 0 must be added before the number. if hexadecimal notation is used, 0x must be added.
What is an integer data type?
The integer data type is an integer that we often call. it can only be an integer. for example, if we write 123456, my age is 20. this is an integer or-123456, which indicates an integer, these are all written in decimal format and can also be written in octal notation.
Number, in hexadecimal format. If octal notation is used, 0 must be added before the number. if hexadecimal notation is used, 0x must be added.
An integer must have a valid range of-2447483648 ~ + 2147483647
Since there is a storage range, do we say that the sum of the two integers must be equal to the integer value? it is not necessarily because the storage range of the two integers is exceeded. this is called overflow, what do you mean? let's just say, take a one-litre cup, you
If you want to install ten liters of water, you will surely not be able to install it. now that you want to install ten liters of water, you can only install it with a bigger container. Therefore, when the given value is beyond the maximum range expressed by the int type, it will be treated as a float
Type processing. the storage range of the floating point type is larger than that of the integer type.
If an invalid number (8 and 9) is displayed in the octal, the subsequent number is ignored.
Integer data type example
In the following example, the output result of octal, decimal, and hexadecimal is as follows:
'; Echo 'decimal result:'. $ str1 .'
'; // Output the decimal integer echo 'hexadecimal result:'. $ str2 .'
'; // The output hexadecimal integer echo 'octal sequence result:'; if ($ str3 = $ str4) {// determine the relationship between $ str3 and $ str4 echo '$ str3 = $ str4 = '. $ str3;} else {echo '$ str3! = $ Str4 ';}?>
Code running result:
The above is the result of the output of integers in different Hexadecimal formats. in the next section, we will introduce the "float" in the scalar data type )".
The above is php: details about integer data type instances. For more information, see other related articles in the first PHP community!