Hi Rowan, Thanks for your reply. I understand your point, but I think it's worth looking at this from a practical perspective.
Right now, ArraySlice doesn't exist in PHP. It's an interesting idea, but it has no RFC, no implementation, and no timeline. We don't know when or if it will happen. array_search_range() solves a real problem today. It's simple, it's focused, and it follows existing PHP conventions like array_slice(). If ArraySlice is ever introduced, I'd be happy to revisit array_search_range() and discuss whether it's still needed. But blocking a useful function on a hypothetical future feature doesn't help users who need it now. The two proposals aren't in competition. One is a small, practical improvement that can land quickly. The other is a larger architectural change that needs much more discussion and design work. I think both can move forward independently. Best, Sepehr On جمعه ۱۴ اوت ۲۰۲۶، ۱۷:۵۴ Rowan Tommins [IMSoP] <[email protected]> wrote: > 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] >
