Re: Missing __toString() part
| From: | Rasmus Lerdorf | Date: | Sat, 03 Jun 2006 17:13:56 +0000 |
| Subject: | Re: Missing __toString() part | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-23892@lists.php.net to get a copy of this message | ||
Stanislav Malyshev wrote:
RL>>I don't understand why using the object as an index would trigger a RL>>__toString() call. PHP's array indices are not defined to be strings, RL>>so I don't see this as being a string context use and thus RL>>__toString() shouldn't be called. If so, what should be the actual key in the hash?I am sure we could come up with some sort of hashing mechanism that would uniquely identify an object. And perhaps even expose it to the user with a __hashOf(). But again, I am not sure we want to open up that can of worms. Like I said, I think this is the more correct approach and that we shouldn't try to use a magic __toString() call here to attempt to emulate this. -Rasmus