On Wed, Mar 15, 2017 at 3:48 AM, Sara Golemon <poll...@php.net> wrote: > > Minor nit: [12=>'foo', 42=>'bar'] is not a packed array. > > [0=>'foo', 2=>'bar'] is however, so your primary point stands. > However it should be simple enough to detect when a packed array is > also vector-like (indexed from 0 to n-1) and make this minor > optimization. > > -Sara >
I didn't realise packed arrays could still have gaps. If that's the case, why can't [12=>'foo', 42=>'bar'] be packed (index 0-11 and 13-41 are undefined)? I agree checking if the array is both packed and without gaps would still make a worthwhile optimisation.