Re: Missing __toString() part
| From: | Gwynne | Date: | Mon, 05 Jun 2006 00:49:12 +0000 |
| Subject: | Re: Missing __toString() part | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-23949@lists.php.net to get a copy of this message | ||
On Jun 4, 2006, at 8:33 PM, Michael Gall wrote:
+1 on that from me. There is definitely a use for a __toHash() magic function WITHOUT it being automagical. An automagical one would probably lead to a lot of confusion and odd behaviors. Let people use the feature if they need it and ignore it otherwise. However, if it was automagical, I'd agree with previous comments: Make it a string based on the hash table pointer. Gwynne SkyTag SoftwareFor example, for an eBay Item object, my __toString() returns the Title, but that's not unique, so my __toHash() returns the numeric ID, which is.While I wouldn't be surprised if you completely ignore my opinion, however I think the __toHash implementation should happen in an interface, rather than happening automagically. That will make it just a little bit more predicatable.