Page 1 of 1

replacing array keys

Posted: Sat Nov 12, 2005 5:03 pm
by Luke
OK... I have an array who's keys all have a prefix of "directory_". How would I traverse through that array and remove that prefix from the keys? Isn't there like an array_key_replace() function or something? I can't find it on php.net.

Posted: Sat Nov 12, 2005 5:09 pm
by RobertGonzalez
This topic was just discussed a little bit ago. There is no way to "change" your array indeces. You can re-write them to new ones while destroying (or unsetting) the originals.

Check out the previous discussion at this topic.

Posted: Sat Nov 12, 2005 5:10 pm
by Luke
Thanks :D