Re: Draft RFC: foreach iteration of keys without values

From: Date: Wed, 02 Sep 2020 14:31:23 +0000
Subject: Re: Draft RFC: foreach iteration of keys without values
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-111783@lists.php.net to get a copy of this message
Hello, I'd also like to propose to use null: [null, null, $username] = getUserData(); foreach ($source as $key => null) {} Regards Thomas > David Rodrigues <david.proweb@gmail.com> hat am 02.09.2020 16:24 geschrieben: > > > I think "void" is a good solution and is very clear, compared to "_". > > [void, void, $username] = getUserData(); > > > Atenciosamente, > David Rodrigues > > > Em qua., 2 de set. de 2020 às 10:57, Dik Takken <dik.takken@gmail.com> > escreveu: > > > On 02-09-2020 15:35, Chase Peeler wrote: > > > Isn't the underscore an alias for gettext()? > > > > You are right, it is. Now this does not necessarily mean that underscore > > cannot be used for ignored variables. Depending on the context in which > > it is used an underscore may or may not be ambiguous. > > > > Since we are talking about using underscore in places where a variable > > name is expected, there may not be any problem at all. But we should be > > aware of all cases in which ambiguous syntax could emerge and identify > > any issues. So thanks a lot for pointing out this possible trouble maker! > > > > Regards, > > Dik Takken > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: https://www.php.net/unsub.php > > > >

« previous php.internals (#111783) next »