Re: Let range() return a generator?

From: Date: Fri, 17 Mar 2017 15:46:46 +0000
Subject: Re: Let range() return a generator?
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-98578@lists.php.net to get a copy of this message
On Fri, Mar 17, 2017 at 1:40 AM, Niklas Keller <me@kelunik.com> wrote: > Yes, that's a BC break. Instead of changing it, there could be a new > function. But as it can be simply built in userland, I don't see much > reason to have it in core. > 100% agreed. This is a 3 line function and doing it in userland means you can use it in 5.5 or later. function range($low, $high) { for ($i = $low; $i <= $high; ++$i) { yield $i; } } -Sara

« previous php.internals (#98578) next »