New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: array_change_keys #1925
RFC: array_change_keys #1925
Conversation
The original methods used could result in arrays containing duplicate keys. For example, if you ran this code: array_combine([1, 2, 3], function(){ return 'foo'; }); You'd have three array elements with the same keys! Didn't even know that was possible.
} | ||
|
||
array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(array))); | ||
params = (zval *)safe_emalloc(2, sizeof(zval), 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since the size is fixed, you could use stack allocated zval[2]
Should this function be named
This also make it appear next to |
What's the status here? The RFC is still listed as being under discussion – are there unresolved issues? |
Sorry, I've been meaning to withdraw this RFC and replace it with a different implementation, but never got around to fleshing that alternative out. I'll close it for now and post to the mailing list. Thanks for the ping! |
RFC: https://wiki.php.net/rfc/array_change_keys