Re: [RFC] array_search_range

From: Date: Thu, 13 Aug 2026 15:36:34 +0000
Subject: Re: [RFC] array_search_range
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-132211@lists.php.net to get a copy of this message
On 12 August 2026 23:56:55 BST, Morgan <weedpacket@varteg.nz> wrote: >On 2026-08-13 02:27, سپهر محمودی wrote: >> Hi everyone, >> >> The main motivation is to provide a memory-efficient way to search within a specific range >> of an array, avoiding the overhead of creating intermediate arrays with array_slice(). >> >Have you thought about expanding this idea to include other functions with similar jobs (e.g. >array_find, array_find_key, array_all, array_any)? I think it would be better to design something more composable - that is, a way to create a "lazy array slice", and then accept that in functions which can use it safely. Swift, for instance, has both ArraySlice and Substring types which let you refer to a subset of an array or string without copying any data: <https://developer.apple.com/documentation/swift/arrayslice> <https://developer.apple.com/documentation/swift/substring> It's conceptually similar to using an Iterator instead of filling an array with a range of values. Regards, Rowan Tommins [IMSoP]

« previous php.internals (#132211) next »