Home >Backend Development >PHP Tutorial >apache - php On a 64-bit machine, int (76561197960265728) will be automatically converted to float type

apache - php On a 64-bit machine, int (76561197960265728) will be automatically converted to float type

WBOY
WBOYOriginal
2016-07-06 13:53:091135browse

1. It runs normally on a personal laptop and Sina server, but this problem occurs when running on a company
. The one in the company is php5.6 and a 64-bit operating system
2. The code is as follows:
apache - php On a 64-bit machine, int (76561197960265728) will be automatically converted to float type
3. The normal result is:
apache - php On a 64-bit machine, int (76561197960265728) will be automatically converted to float type
4. The abnormal result:

apache - php On a 64-bit machine, int (76561197960265728) will be automatically converted to float type

5. What is the reason for this? Is it a problem with the PHP version, the operating system, or something else?

Reply content:

1. It runs normally on a personal laptop and Sina server, but this problem occurs when running on a company
. The one in the company is php5.6 and a 64-bit operating system
2. The code is as follows:
apache - php On a 64-bit machine, int (76561197960265728) will be automatically converted to float type
3. The normal result is:
apache - php On a 64-bit machine, int (76561197960265728) will be automatically converted to float type
4. The abnormal result:

apache - php On a 64-bit machine, int (76561197960265728) will be automatically converted to float type

5. What is the reason for this? Is it a problem with the PHP version, the operating system, or something else?

http://php.net/manual/zh/language.types.integer.php

<code>如果给定的一个数超出了 integer 的范围,将会被解释为 float。同样如果执行的运算结果超出了 integer 范围,也会返回 float。</code>

You can try it first PHP_INT_MAX and see if there is any difference in size between your machine and the service


I don’t dare to solve this problem by converting the final result to string

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn