Re: How to parse data type array columns? - Mailing list pgsql-php

From Christopher Kings-Lynne
Subject Re: How to parse data type array columns?
Date
Msg-id 4301A70D.5010507@familyhealth.com.au
Whole thread Raw
In response to How to parse data type array columns?  (Janning Vygen <vygen@gmx.de>)
List pgsql-php
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


pgsql-php by date:

Previous
From: Janning Vygen
Date:
Subject: How to parse data type array columns?
Next
From: Greg Stark
Date:
Subject: Re: How to parse data type array columns?