What I actually need, not the object hash but simply its unique id.
And in this case "object(Foo)#1" would be just fine. How can I get it?
That was my original Question too;) It's been stated that the automatic
cast into a string even if it does not implement the __toString()
function was "absolute nonsense"...but it really helped alot when you
needed to check for errors quickly and easily. Why make something harder
than it has to be.
Why not allow the old behaviour as long as the __toString is not
implemented? Or rather something like a default implementation which is
used autmatically for every class which doesn't implement it itself?
public function __toString(){
return 'Object '. get_class($this) .'('. get_object_id($this) .')';
}
That'd be nice and no code breakage would result. Isn't that an approach
that fits into the PHP philosophy? The new behaviour reminds me of
Java's "the more userland-code, the better".
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php