Home > Backend Development > PHP Tutorial > php数组的数字key最大多少

php数组的数字key最大多少

WBOY
Release: 2016-06-06 20:32:16
Original
1403 people have browsed it

<code>php</code><code>//18614004082为手机号
$arr[18614004082] = 9;
var_dump($arr);//1434134898 => 9
</code>
Copy after login
Copy after login

回复内容:

<code>php</code><code>//18614004082为手机号
$arr[18614004082] = 9;
var_dump($arr);//1434134898 => 9
</code>
Copy after login
Copy after login

就是Integer 整型的范围,最大值应该是PHP_INT_MAX常量的值,你这个值根本不会出问题。你的输出好像是一个时间戳,看看程序哪里出错了吧~

http://3v4l.org/k15Wq

array(1) {
[507887842]=>
int(8)
}
上面是我们输出的结果,我定义的13392789730作为数组的下标,估计也是超出php数组的定义范围了

php数组的数字key最大多少

带符号int最大2147483647,上面代码,加1自动转为float。更大的话,超出一定限制,就以科学计数法表示。PHP对大数的话也是有做处理的。

php.ini中查看

key可以用字符串类型,如果超出int范围

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template