Page 1 of 1

Maximum length for array key?

Posted: Thu May 01, 2008 2:54 pm
by seodevhead
Hey guys... I am building an array that uses string indexes and wasn't sure if there is a MAX to the number of characters you can have in the index name of an array's element. Example:

Code: Select all

$zipCodes = array(
     'Saint Delmarca de Angelo of West Corpus Christie' => 39288
     'Le Tettelluna San Madrid in East Corpus Equadoria' => 38723
);
..or can I use as long a string as I want? It just looks wierd having the key be so long, but thought I'd ask to be on the safe side. Thanks.

Re: Maximum length for array key?

Posted: Thu May 01, 2008 3:02 pm
by Mordred
rtfm wrote:A key may be either an integer or a string.
rtfm wrote:Note: It is no problem for a string to become very large. There is no practical bound to the size of strings imposed by PHP, so there is no reason at all to worry about long strings.