tags:

views:

117

answers:

2

Is there a function which makes

$array['blue']='Color';

to

$array['Color']=blue'

And also, is there a limit on what characters can go inside an array index?

+10  A: 

array_flip()

usoban
is there a limit on what characters can go inside an array index?
Click Upvote
As far as I know there isnt', maybe you can't use double or single quotation (', ") or you have to escape them.
usoban
+1  A: 

As for the type of characters that can be used as a key, there seems to be no limit (accents, quotes, and other characters are accepted).

As for the size limit, there isn't any either, the only restriction is the script's memory limit (see "What is the max key size for an array in PHP?"

Couldn't find any official PHP documentation mentioning this though.

altermativ