Re: Replacing array_slice

From: Date: Tue, 17 Jul 2018 05:51:58 +0000
Subject: Re: Replacing array_slice
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-102877@lists.php.net to get a copy of this message
On Tue, Jul 17, 2018 at 2:11 PM, Levi Morrison <levim@php.net> 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 $array->drop($offset)->take($length), where both ->drop() and ->take() add the array's length if the argument is negative.

« previous php.internals (#102877) next »