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 94A3152A72 for ; Tue, 16 Aug 2005 05:02:59 -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 94977-10 for ; Tue, 16 Aug 2005 08:02:56 +0000 (GMT) Received: from pw6tiger.de (pw6tiger.de [217.160.140.116]) by svr1.postgresql.org (Postfix) with SMTP id 77B9552A2C for ; Tue, 16 Aug 2005 05:02:54 -0300 (ADT) Received: (qmail 8523 invoked by uid 505); 16 Aug 2005 08:02:55 -0000 Received: from vygen@gmx.de by planwerk6 by uid 89 with qmail-scanner-1.14 (virus scan: Clear:. Processed in 0.727199 secs); 16 Aug 2005 08:02:55 -0000 Received: from unknown (HELO jv.pw6.de) (vygen@planwerk6.de@213.128.112.129) by pw6tiger.de with SMTP; 16 Aug 2005 08:02:54 -0000 From: Janning Vygen To: pgsql-php@postgresql.org Subject: How to parse data type array columns? Date: Tue, 16 Aug 2005 10:04:07 +0200 User-Agent: KMail/1.7.2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200508161004.07400.vygen@gmx.de> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.023 required=5 tests=[AWL=0.023] X-Spam-Level: X-Archive-Number: 200508/3 X-Sequence-Number: 3215 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