replacing array keys
Moderator: General Moderators
replacing array keys
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.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
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.
Check out the previous discussion at this topic.
Last edited by RobertGonzalez on Sat Nov 12, 2005 5:10 pm, edited 1 time in total.