Re: [PHP-DEV] [RFC] array_search_range
"Sjoerd Langkemper" <[email protected]>
| Newsgroups | gmane.comp.php.devel |
|---|---|
| Message-ID | <[email protected]> |
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