PHP关联数组的键(索引)限制?

前端之家收集整理的这篇文章主要介绍了PHP关联数组的键(索引)限制?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如果 PHP中的数组键有某些限制?长度 ?不接受的字符串?

official documentation中只发现了这一点,但没有关于键限制的信息.

A key may be either an integer or a string. If a key is the standard representation of an integer,it will be interpreted as such (i.e. “8” will be interpreted as 8,while “08” will be interpreted as “08”). Floats in key are truncated to integer. The indexed and associative array types are the same type in PHP,which can both contain integer and string indices.*

What is the max key size for an array in PHP?

这个问题几乎完全相同.但如果你不想信任任何非官方的东西,只要坚持使用较少的小钥匙.您甚至可以从中获得一些性能优势.

编辑:正如The PHP Manual所说:

Note: It is no problem for a string to become very large. PHP imposes no boundary on the size of a string; the only limit is the available memory of the computer on which PHP is running..

原文链接:https://www.f2er.com/php/137636.html

猜你在找的PHP相关文章