Le lundi 30 mai 2016, 01:40:21 Colin O'Dell a écrit : > Marco, > > > > 1. could you also provide the code for the benchmarks? I'd gladly measure > > them with an accurate tool > > > > Yeah that would be great! Here's the benchmark I was using: > https://gist.github.com/colinodell/872c1f0c92351af687347c0c8be4f253 > > > > 2. do we really need another array function that is basically an > > `array_combine(array_map($someFunc, array_keys($arr)), $arr)`? > > > > While array_combine() technically works, the callback does not have access > to both the key AND value. Anyone needing access to both must currently > resort to using a foreach loop (unless there's some other clever > combination of functions that I'm missing).
Yes there is: array_combine( array_map($someFunc, array_keys($arr), $arr), $arr ) This way $someFunc gets key as first argument and value as second. (you might use array_values($arr) instead of $arr but I’m not sure it’s worth it) Côme
signature.asc
Description: This is a digitally signed message part.