Possible Duplicate:
What is the max key size for an array in PHP?
As the title says, I'm wondering what are the limits to PHP's arrays?
What are the limits to array keys?
There is no theoretical limits more then the size of memory allocated to the script. You can also find a proof at What is the max key size for an array in PHP?
The php manual says here;
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.
This matters since the keys in a array can be strings.
Can I use any size string as the key?
Yes, depending on the amount of memory allocated for the script. You can set the size by starting you script with for example ini_set('memory_limit', '1024M');
this set amount of memory to one gigabyte. To set the memory limit to unlimited use -1
.
BUT when the size of the keys grows you will need more power to work with the array.
At what point will keys start to collide?
(I do not now if I understod the questions property)If you use all the combinations of letters and numbers up to a infinity long string, there will be infinity numbers of combinations. And therefor they will never collide.
What is the size limit to a php array?
It is limited in the same way as above, by the amount of memory allocated for the script.