Re: [RFC] array_search_range
| From: | Rowan Tommins [IMSoP] | Date: | Fri, 14 Aug 2026 14:21:31 +0000 |
| Subject: | Re: [RFC] array_search_range | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-132220@lists.php.net to get a copy of this message | ||
Hi Sepehr,
On 13 August 2026 17:31:39 BST, "سپهر محمودی" <sepehrphpr@gmail.com>
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]