Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:23884 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47762 invoked by uid 1010); 3 Jun 2006 13:35:13 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 47747 invoked from network); 3 Jun 2006 13:35:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jun 2006 13:35:13 -0000 X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.94.239.5 jdi.jdi-ict.nl Linux 2.5 (sometimes 2.4) (4) Received: from ([82.94.239.5:50389] helo=jdi.jdi-ict.nl) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 71/C9-22639-F0091844 for ; Sat, 03 Jun 2006 09:35:12 -0400 Received: from localhost (localhost [127.0.0.1]) by jdi.jdi-ict.nl (8.13.6/8.12.11) with ESMTP id k53DZ7rm003577; Sat, 3 Jun 2006 15:35:07 +0200 Date: Sat, 3 Jun 2006 15:34:42 +0200 (CEST) X-X-Sender: derick@localhost To: Marcus Boerger cc: Robert Amos , internals@lists.php.net In-Reply-To: <1782297159.20060603150251@marcus-boerger.de> Message-ID: References: <795156743.20060603134212@marcus-boerger.de> <281938697.20060603144727@marcus-boerger.de> <1944df00606030555i4e0e1c21oa6db0ede201dc021@mail.gmail.com> <1782297159.20060603150251@marcus-boerger.de> X-Face: "L'&?Ah3MYF@FB4hU'XhNhLB]222(Lbr2Y@F:GE[OO;"F5p>qtFBl|yVVA&D{A(g3[C}mG:199P+5C'v.M/u@Z\![0b:Mv.[l6[uWl' MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] Missing __toString() part From: derick@php.net (Derick Rethans) On Sat, 3 Jun 2006, Marcus Boerger wrote: > Hello Robert, > > well lazy is a good point here but __toString is all about lazyness. > Then again as said you might want to have objects naturally convert > to strings whereever possible. Generally when providing a __toString > implementation you say that you want this. And then you might as well > expect that your objects can be used as index to arrays. > > The example is as said an object that can be used to calculate the > index to an array. Assuming you deal with persons derived from > a database as classes, your person objects might be implmeneted so > that __toString simply returns the name of the persons. Now when your > application also has an array that stores more information about the > persons it would be nice if you could access that array direectly by > your peson objects. Makes sense to me, so +1. Derick -- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org