Jump to content

Recommended Posts

I've discovered that when you do something like:

 

MyArray['My Key.Thing'] = 37;

 

the key value actually gets modified and becomes "My_Key_Thing". That is, it translates certain characters into underscores. In particular it translates spaces and decimal points. Maybe it also translates other characters.

 

Is there a way to tell it to NOT do that translation?

 

Or, if that's not possible, is there a function I can call that will do the same kind of translation so that I can produce a "proper" string myself for the key?

Link to comment
https://forums.phpfreaks.com/topic/57792-array-key-value-problem/
Share on other sites

I don't think spaces are valid in a array key, also periods serve as linkers so it is assuming you are linking the phrase My Key and Thing together into an array key.  I'd just use a different key if its not a big issue, If you really need to use "spaces" you could try using a psedo space character and then strreplace it out when you need to echo out the key

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.