Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:1271 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5973 invoked from network); 5 May 2003 14:24:48 -0000 Received: from unknown (HELO carmine.bestweb.net) (209.94.102.73) by pb1.pair.com with SMTP; 5 May 2003 14:24:48 -0000 Received: from [192.168.1.100] (ip216-179-71-153.cust.bestweb.net [216.179.71.153]) by carmine.bestweb.net (Postfix) with ESMTP id D1830231AC for ; Mon, 5 May 2003 09:24:42 -0500 (EST) To: internals@lists.php.net Content-Type: text/plain Organization: Message-ID: <1052139665.11377.339.camel@hasele> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 05 May 2003 09:01:05 -0400 Content-Transfer-Encoding: 7bit Subject: __asType() From: sterling@bumblebury.com (Sterling Hughes) Hi, When developing my SimpleXML extension, I've come to a situation where I want to have the ability (internally), to convert my object to a base type, when requested. I need this when both attributes and xml tags are identical within the same context, ie: data.xml 30 name.php id; ?> I'd like the ability to provide two modes of access for the object, array and object. So, one could do: $n['id']; // attr And $n->id; // node However, barring that, I'd like the ability to simply cast the object as a base type, essentially :: echo $n->id; echo $n->id->get_attr('type'); And have them both work. Are either of these a possibility? -Sterling -- "Reductionists like to take things apart. The rest of us are just trying to get it together." - Larry Wall, Programming Perl, 3rd Edition