Re: [PHP-DEV] [RFC] array_search_range

"Rowan Tommins [IMSoP]" <[email protected]>
Newsgroups gmane.comp.php.devel
Message-ID <[email protected]>
Hi Sepehr,

On 13 August 2026 17:31:39 BST, "سپهر محمودی" <[email protected]> wrote:
>I think it's a bigger topic than this RFC, so I'd love to explore it
>properly in a separate proposal. For now, I'll keep array_search_range()
>focused on its simple use case, and I'm happy to help shape the lazy
>slice idea when the time comes.

While I appreciate that it's a harder feature to design and implement, I don't think it makes sense to treat it as a separate discussion, because if we add an ArraySlice type then array_search_range would immediately become redundant:

array_search_range('target', $arr, 2, 10, true)

Would be the same as: 

array_search('target', new ArraySlice($arr, 2, 10), true)

Or maybe even: 

array_search('target', $arr[2..10], true)

So I think it's only worth adding array_search_range if we think a more general solution is so hard that it will never happen, or not happen for many years.


PS: The convention on this list is to post replies below the (edited) text you're replying to, like I've done here, rather than above it.

Thanks,

Rowan Tommins
[IMSoP]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.