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.
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! |
|
Can this be reopened if its not hard to implement? |
RFC: https://wiki.php.net/rfc/array_change_keys