Re: [RFC] Allow non-scalar keys in foreach

From: Date: Tue, 19 Feb 2013 13:25:27 +0000
Subject: Re: [RFC] Allow non-scalar keys in foreach
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Tue, 19 Feb 2013, Nikita Popov wrote:

> This RFC proposes to remove the type-restrictions on Iterator keys 
> used in foreach:
> 
> https://wiki.php.net/rfc/foreach-non-scalar-keys
> 
> I took over Levi's RFC and added a patch for it.

Under "Open Questions" you write:

> What should be done with the keys that are valid in the iterator, but not in
> the array? I think the best approach would be to just set the array keys with
> the exact same semantics as PHP would do (i.e. with all casts and warnings).

Would __toString be called in case the key was an object?

cheers,
Derick

-- 
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug
Posted with an email client that doesn't mangle email: alpine


Thread (8 messages)

« previous php.internals (#65943) next »