array keys

by Guna 2012-12-24 18:22:21

What is the maximum keys length for arrays in php?

A quick test got me a key of 128mb no problem:

ini_set('memory_limit', '1024M');

$key = str_repeat('x', 1024 * 1024 * 12Cool
;

$foo = array($key => $key);

echo strlen(key($foo)) . "
";
echo strlen($foo[$key]) . "
";


As per PHP manual:
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.

Tagged in:

821
like
0
dislike
0
mail
flag

You must LOGIN to add comments