On Feb 29, 2004, at 12:03 PM, Andi Gutmans wrote:
I think there isn't a problem with "echo" as it will call the string handler. However, in other cases it might be problematic.
Maybe a solution is to implement an equals function so that people would do:
if ($doc->name->equals("Hello")) ?
I don't think we can support auto-string conversion transparently everywhere in the engine. print and echo are special cases and we also supported make_printable_zval() in PHP 4.
Well, the comparison operator should be overloaded if one of the objects is an overloaded object imho.
The problem is that user-land overloading can't be supported. C extensions might be able to be supported but I don't think it's a good idea to start hacking this into PHP. It wouldn't end at the comparison operator but people would want it to work everywhere.
My concern lies more with functions like utf8_encode() not properly getting the contents of the XML string - but I haven't looked into it too much - I'll try and get some hacking done on the cruise.
The way to do it today is to do a cast to (string) although I admit it's not a beautiful solution.
Andi
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php