PHP data type integer type, floating-point number introduction _php tutorial

Source: Internet
Author: User

Syntax: integer values can be expressed in decimal, hexadecimal, or octal, preceded by an optional symbol (-or +). Octal indicates that the number must be preceded by 0 (0), and hexadecimal indicates that the number must be preceded by 0x.

$int 1=100; Decimal
$int 2=-123; Negative
$int 3=0123; Octal number
$int 4=0x1a;//Hexadecimal number

echo php_int_size; Displays an integer in a few bytes to represent
echo "
";
echo Php_int_max, echo "
";//integer maximum number (2147483647)
$fmax = 2147483648;
Var_dump (Php_int_max); a number that exceeds the range of integers will be interpreted as a float type.
echo "
";
Var_dump ($fmax);

Floating-point numbers: floating-point numbers (double-precision or real numbers)
$a = 1.34;
$b =1.8e308;
$c =8e-10;
Var_dump ($b);
The length of the floating-point number is relative to the platform, although the usual maximum value is 1.8e308 and has a precision of 14-bit decimal digits (no more than 14 bits)
The precision is calculated from the first non-0 number that begins on the left.

Example: $a = 567.9999899//Output 567.9999899

$b = 789.8812345678543//Output 789.88123456785

$c = 0.000000008907777777//Output 0.000000008907777777

Important understanding: The accuracy is calculated from the first non-0 number starting on the left.

http://www.bkjia.com/PHPjc/326908.html www.bkjia.com true http://www.bkjia.com/PHPjc/326908.html techarticle syntax: integer values can be expressed in decimal, hexadecimal, or octal, preceded by an optional symbol (-or +). Octal notation must be preceded by a number of 0 (0), 16 ...

  • Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.