Re: [RFC] array_search_range
| From: | Sjoerd Langkemper | Date: | Fri, 14 Aug 2026 19:51:51 +0000 |
| Subject: | Re: [RFC] array_search_range | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-132223@lists.php.net to get a copy of this message | ||
On Fri, Aug 14, 2026, at 20:32, Rowan Tommins [IMSoP] wrote:
> At heart, an ArraySlice object would just be a holder for those three values, plus a bit of
> code to iterate over that subset. Custom syntax would be nice, but easy to add later.
>
> Thinking about it, it ought to be trivial to build something on top of ArrayIterator, which
> already has a seek() method to jump to the start point. Which brings back a frequent debate about
> how the array_* functions should interact with iterators in general - should it actually be:
>
> iter_search(new ArraySliceIterator($arr, 10, 42), true)
LimitIterator (https://www.php.net/manual/en/class.limititerator.php) more or less does this. But as
you said, you cannot pass this to array_search, because that expects an array.
Regards,
Sjoerd