Re: objects as string and arrays as string

From: Date: Fri, 16 Aug 2002 14:17:35 +0000
Subject: Re: objects as string and arrays as string
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-86900@lists.php.net to get a copy of this message
At 15:52 16.08.2002, Brad LaFountain 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?
Nice to have... marcus

« previous php.dev (#86900) next »