pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Janning Vygen <vygen@gmx.de>
To: pgsql-php@postgresql.org
Subject: How to parse data type array columns?
Date: Tue, 16 Aug 2005 10:04:07 +0200
Message-ID: <200508161004.07400.vygen@gmx.de> (raw)

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



view thread (10+ messages)  latest in thread

Message-ID: <200508161004.07400.vygen@gmx.de>
Permalink:  ../200508161004.07400.vygen@gmx.de/
Also on:    postgresql.org/message-id/200508161004.07400.vygen@gmx.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: vygen@gmx.de
  Subject: Re: How to parse data type array columns?
  In-Reply-To: <200508161004.07400.vygen@gmx.de>
  References: <200508161004.07400.vygen@gmx.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox