Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:15029 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79259 invoked by uid 1010); 16 Feb 2005 20:10:58 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 79228 invoked from network); 16 Feb 2005 20:10:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2005 20:10:58 -0000 X-Host-Fingerprint: 83.97.50.139 jan.prima.de FreeBSD 4.6-4.8 (no RFC1323) Received: from ([83.97.50.139:1919] helo=jan.prima.de) by pb1.pair.com (ecelerity 1.2 (r4437)) with SMTP id 55/15-15379-0D8A3124 for ; Wed, 16 Feb 2005 15:10:57 -0500 Received: from BAUMBART (p508EB406.dip.t-dialin.net [::ffff:80.142.180.6]) (IDENT: HydraIRC, AUTH: LOGIN tobi) by jan.prima.de with esmtp; Wed, 16 Feb 2005 20:10:39 +0000 Date: Wed, 16 Feb 2005 21:10:46 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1192315462.20050216211046@marcus-boerger.de> To: Leendert Brouwer CC: internals@lists.php.net In-Reply-To: <20050214122557.92260.qmail@lists.php.net> References: <20050214122557.92260.qmail@lists.php.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] toString() in SimpleXML? From: helly@php.net (Marcus Boerger) Hello Leendert, having a function __toString() would interfere with the mapping ideas of SimpleXML. However it is there internally so you simply do one of the following: php -r '$x=SimpleXML_load_string("blablabla"); echo $x, "\n"; var_dump((string)$x);' regards marcus further questions please to general@php.net Monday, February 14, 2005, 1:23:44 PM, you wrote: > Hi, > I have a feature request. Maybe it would be a good idea to have a > toString() or perhaps nodeValue() method in SimpleXML's SimpleXMLElement > class? It might make it more obvious that the element is still a > SimpleXMLElement object when you want to actually use it (when you print > it, the value automagically casts to a string internally, so users might > think that it will be casted to a string when you directly access it > without a specified property/method, which is not the case). I know that > the docs say that you should cast it to a string when you want to do a > comparison, but apart from that just being an example, maybe my > suggestion is a more obvious one to notice? > regards, > Leendert -- Best regards, Marcus mailto:helly@php.net