Re: [PHP-DEV] Replacing array_slice

2018-07-17 Thread Levi Morrison
On Tue, Jul 17, 2018 at 6:24 AM Gabriel Caruso wrote: > > Hi Levi, thanks for bringing this discussion. > >> Recently I've been scrutinizing array_slice. It's been painful. >> >> For instance, `$preserve_keys` is totally ignored for string keys. >> This was undocumented until Christoph integrated

Re: [PHP-DEV] Replacing array_slice

2018-07-17 Thread Gabriel Caruso
Hi Levi, thanks for bringing this discussion. Recently I've been scrutinizing array_slice. It's been painful. > > For instance, `$preserve_keys` is totally ignored for string keys. > This was undocumented until Christoph integrated it 2-3 days ago > (thanks, cmb). However, this is really not a goo

Re: [PHP-DEV] Replacing array_slice

2018-07-17 Thread rich gray
On 17/07/2018 05:11, Levi Morrison wrote: Fixing `array_slice` would probably do more harm than good at this stage. Instead I would like to provide an alternative function that does not have all this baggage, and will have decent performance much of the time. The best ideas I have for names are n

Re: [PHP-DEV] Replacing array_slice

2018-07-16 Thread Enno Woortmann
Am 17.07.2018 um 07:35 schrieb Zeev Suraski: On 17 Jul 2018, at 7:12, Levi Morrison wrote: Fixing `array_slice` would probably do more harm than good at this stage. Instead I would like to provide an alternative function that does not have all this baggage, and will have decent performance much

Re: [PHP-DEV] Replacing array_slice

2018-07-16 Thread Jesse Schalken
On Tue, Jul 17, 2018 at 2:11 PM, Levi Morrison wrote: > And another: `$length` is a length when it's a positive number, but > it's an offset from the end when it's negative. > That's how substr() works, so it's at least consistent with that. It makes a lot more sense if you think of it as $arra

Re: [PHP-DEV] Replacing array_slice

2018-07-16 Thread Zeev Suraski
> On 17 Jul 2018, at 7:12, Levi Morrison wrote: > > Fixing `array_slice` would probably do more harm than good at this > stage. Instead I would like to provide an alternative function that > does not have all this baggage, and will have decent performance much > of the time. The best ideas I ha

[PHP-DEV] Replacing array_slice

2018-07-16 Thread Levi Morrison
Recently I've been scrutinizing array_slice. It's been painful. For instance, `$preserve_keys` is totally ignored for string keys. This was undocumented until Christoph integrated it 2-3 days ago (thanks, cmb). However, this is really not a good design decision: why have a parameter that is called