Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:30389 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64304 invoked by uid 1010); 1 Jul 2007 19:38:45 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 64289 invoked from network); 1 Jul 2007 19:38:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jul 2007 19:38:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=schultz@widescreen.ch; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=schultz@widescreen.ch; sender-id=unknown Received-SPF: error (pb1.pair.com: domain widescreen.ch from 213.46.255.22 cause and error) X-PHP-List-Original-Sender: schultz@widescreen.ch X-Host-Fingerprint: 213.46.255.22 viefep18-int.chello.at Solaris 10 (beta) Received: from [213.46.255.22] ([213.46.255.22:36887] helo=viefep24-int.chello.at) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 56/49-32240-2C208864 for ; Sun, 01 Jul 2007 15:38:44 -0400 Received: from [127.0.0.1] (really [77.56.205.104]) by viefep24-int.chello.at (InterMail vM.7.08.02.00 201-2186-121-20061213) with ESMTP id <20070701193839.GVJC12976.viefep24-int.chello.at@[127.0.0.1]> for ; Sun, 1 Jul 2007 21:38:39 +0200 Message-ID: <468802C1.7000507@widescreen.ch> Date: Sun, 01 Jul 2007 21:38:41 +0200 User-Agent: Thunderbird 1.5.0.12 (Windows/20070509) MIME-Version: 1.0 To: internals@lists.php.net References: <468519DC.8060502@widescreen.ch> <4685785E.5010709@zend.com> <585221804.20070701154538@marcus-boerger.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 000752-8, 01.07.2007), Outbound message X-Antivirus-Status: Clean Subject: Re: [PHP-DEV] toString() and Object #ID From: schultz@widescreen.ch (Lars Schultz) > 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".