Cast would work for both key and value, although I think the instances
where you need to cast a key will be fewer.
On Thu, Feb 21, 2019, 15:08 Legale.legale wrote:
> what about:
>
> foreach($array as $i=>$v) {}
>
> ?On Feb 21, 2019 13:15, Chris Riley wrote:
> >
> > Hi internals,
> >
> > I'd lik
In this instance, I would expect the cast to come before each variable
eg foreach ($data as ["id" => (int) $id, "name" => (string) $name])
On Thu, Feb 21, 2019, 13:28 Kalle Sommer Nielsen wrote:
> Den tor. 21. feb. 2019 kl. 14.16 skrev Chris Riley :
> >
> > Hi internals,
> >
> > I'd like to prop
Hi!
> 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;
> }
This doesn't seem to add anything to existing functionality - what's
wrong with just maki
what about:
foreach($array as $i=>$v) {}
?On Feb 21, 2019 13:15, Chris Riley 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
On Thu, Feb 21, 2019 at 3:36 PM Kalle Sommer Nielsen wrote:
>
> Den tor. 21. feb. 2019 kl. 14.16 skrev Chris Riley :
> >
> > Hi internals,
> >
> > I'd like to propose opening an rfc to make the following syntax legal:
> >
> > foreach($array as (int) $i) {}
>
> How would this interact with the fore
Den tor. 21. feb. 2019 kl. 14.16 skrev Chris Riley :
>
> Hi internals,
>
> I'd like to propose opening an rfc to make the following syntax legal:
>
> foreach($array as (int) $i) {}
How would this interact with the foreach-list syntax?
$data = [
["id" => 1, "name" => 'Tom'],
["id" => 2, "n
On Thu, Feb 21, 2019 at 1:16 PM Chris Riley 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?
> ~
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