X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8643852AAB for ; Tue, 16 Aug 2005 05:41:18 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08983-03 for ; Tue, 16 Aug 2005 08:41:15 +0000 (GMT) Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id A55A152AB8 for ; Tue, 16 Aug 2005 05:41:13 -0300 (ADT) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id CEC5B24FF1; Tue, 16 Aug 2005 16:41:12 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id B00E824FE5; Tue, 16 Aug 2005 16:41:11 +0800 (WST) Message-ID: <4301A70D.5010507@familyhealth.com.au> Date: Tue, 16 Aug 2005 16:42:53 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Janning Vygen Cc: pgsql-php@postgresql.org Subject: Re: How to parse data type array columns? References: <200508161004.07400.vygen@gmx.de> In-Reply-To: <200508161004.07400.vygen@gmx.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-familyhealth-MailScanner-Information: Please contact the ISP for more information X-familyhealth-MailScanner: Found to be clean X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.062 required=5 tests=[AWL=0.012, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200508/4 X-Sequence-Number: 3216 Look at phpArray() in lib/classes/ADODB_base.pclass in the phpPgAdmin 3.5 source distribution. It's not recursive - just parsed 1-d arrays. Also doesn't support leading dimension indication. Chris Janning Vygen wrote: > Hi, > > if you use array data type in your database design and query your tables with > PHP you get a string which represents the array. It can look something like > this: > > [1:2]{{"Hallo", "Te\"st},"},{"Hallo", "Test"}} > > It can even have another delimiter than "," if you change the type delimiter. > > Has anybody already written a function to parse this array into an php array > structure? A simple explode doesn't work of course. The list offers a too > simple explode(",", ereg_replace("{[-]}", $string)). this works only with one > level and numeric types. > > Has anybody already written a recursive function to parse the array string? > > kind regards, > Janning > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq