如果
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?
原文链接:https://www.f2er.com/php/137636.html这个问题几乎完全相同.但如果你不想信任任何非官方的东西,只要坚持使用较少的小钥匙.您甚至可以从中获得一些性能优势.
编辑:正如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..