If you are going to create an interface, the most
reasonable way of implementing that, is by not doing
so much magic, and only permit the cast explicitly
using (string)$obj for objects that implements the
interface Stringable.
So problems like:
return $someobject . "";
could be solved by using:
return (string)$someobject;
The same reflects on Jon�s example:
function printException($e)
{
if (is_object($e) && method_exists($e,
'__toString')) {
print $e->__toString();
} else {
print $e;
}
}
could just be:
function printException($e)
{
print (string)$e;
}
Marc.
__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php