I went back and read the lists about why people don't like __to_string() or __string_value() method.
the arguments were the differences in when convert_to_string vs zend_make_printable_zval were called differently. I believe andi isn't against it but wants it implemented good and zeev was all for it. I think it should be implemented, Like I said before its not that creating your own "stringify" and calling it is being lazy. Sometimes when debugging you don't necesarrly know what "Object" you are printing out.. say because of nested objects. The issues that were brought up were it would't be consisitant becuase of echo $obj; or $p = (string)$obj; I think that everytime it should be used in the context of a string the method should be called. Not when you use var_dump. var_dump means you want to dump the contents of the variable (object in this case). You don't want to convert it to a string. $p = (string)$obj; // will call method $p .= $obj; // will call method var_dump($obj); // wont call method $p = $obj . "\n"; // will call method $p = "$obj\n"; // will call method The other consern was recursive nature that could be introduced. As mentioned in the other posts you could either require to return a string or try and handle the recursion (maybe like var_dump currently does it). -brad --- Brad LaFountain <[EMAIL PROTECTED]> wrote: > I want to throw together a quick hack so that objects can implement a > __as_string() method that will get called when the string is used in a string > contex. Instead of append "Object". > > $s = (string)$object; > or > $s .= $object; > > also the same things with arrays that will do something similar to > $s = implode(" ", $array); > > $s = (string)$array; > $s = $array . "\n"; > > Before anyone jumps on this and says no way cause it easy to implemnt your > own > __to_string() and call it when you want it or what is wrong with implode(" ", > $array). Think of exactly how usefull is appending the word "Array" or > "Object". > > Thoughts? > > - brad > > __________________________________________________ > Do You Yahoo!? > HotJobs - Search Thousands of New Jobs > http://www.hotjobs.com > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, visit: http://www.php.net/unsub.php > __________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php