On 2014-09-23 11:45, Leigh wrote: > On 23 September 2014 10:35, Michael Wallner <m...@php.net> wrote: >> On 2014-09-23 11:15, Leigh wrote: >>> He doesn't want to add the object as a key, he wants to invoke __toString(). >> >> Did I write that? > > No, you didn't, sorry. > > I just didn't see how an object with an explicit method to convert it > to a string compared to using a resource straight up as a key. If you > were implying the resource would be cast to int, then I get the > comparison. > > Does it really make bugs that hard to find? You'd expect the user to > know when they're using this behaviour when they write the code... > well, I would. > > I suppose explicit casting removes any ambiguity, we use > $a[(int)$resource] all the time for arrays of sockets and that's > served us fine over the years. Hmm, thinking about it > $a[(string)$object] is a lot clearer than having some magic sort it > out. You're right, I'll retreat now :) >
I'm a "victim" of $array[(int) $resource] myself. I just tried to explain that the behavior is intentional and not an oversight. That doesn't mean that is set in stone for all times. -- Regards, Mike -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php