Hello everyone, I'd like to introduce a new RFC for your consideration and discussion: https://wiki.php.net/rfc/array_change_keys This would add a new function named array_change_keys() which simplifies the process of re-keying an array.
PHP currently has an array_change_key_case() method, but this only allows keys to be changed to upper- or lower-case; no method exists to change the keys to some custom user-defined value. Although it's absolutely possible to accomplish this without a special function, the alternate approaches have several drawbacks: - Slower execution time compared to the proposed implementation. - Multiple lines and/or function calls are required. - Harder to understand the code's purpose with a quick glance. - The result of a "foreach" approach cannot be passed into another function without using an intermediate variable. A working implementation has been included with the RFC (huge thanks to Jeremy Mikola for the heavy lifting here!) I've also requested this patch be added to 3v4l.org; I'll notify everyone if/when that happens. I'd greatly appreciate if you could review this RFC and let me know your thoughts. I'd be happy to answer any questions you might have. Regards, Colin O'Dell