Re: [RFC] Cast in foreach

From: Date: Thu, 21 Feb 2019 12:27:39 +0000
Subject: Re: [RFC] Cast in foreach
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-104486@lists.php.net to get a copy of this message
On Thu, Feb 21, 2019 at 1:16 PM Chris Riley <t.carnage@gmail.com> wrote: > Hi internals, > > I'd like to propose opening an rfc to make the following syntax legal: > > foreach($array as (int) $i) {} > > Which would be functionally equivalent to > > foreach($array as $i) { > $i=(int) $i; > } > > Thoughts? Feedback? > ~C > What's a scope where this would be a massive win, over a new line with a cast? Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/

« previous php.internals (#104486) next »