Re: converting multi-dim arrays to php assoc arrays - Mailing list pgsql-general

From Arjen van der Meijden
Subject Re: converting multi-dim arrays to php assoc arrays
Date
Msg-id 003c01c2cabf$b4a5bc40$3ac15e91@acm
Whole thread Raw
In response to converting multi-dim arrays to php assoc arrays  (John Smith <john_smith_45678@yahoo.com>)
List pgsql-general
What about something like:
// strip off the first {{ and last }}
$array = explode('},{', $pg_array);
$php_array = array();
foreach($array as $elements)
{
   $temp_array = explode(',', $elements);
   $php_array[$temp_array[0]] = $temp_array[1];
}

This is not a very generic solution though.

Regards,

Arjen

Van: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] Namens John Smith
Verzonden: zondag 2 februari 2003 10:37
Aan: pgsql-general@postgresql.org
Onderwerp: [GENERAL] converting multi-dim arrays to php assoc arrays


Anybody have a method for converting multi-dimensional PG columns to PHP
associative arrays? ie.
{{1,123},{2,234},{3,345},{4,456}}
becomes
1 => 123, 2 => 234, 3=> 345, 4 => 456




Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now



pgsql-general by date:

Previous
From: Arjen van der Meijden
Date:
Subject: Re: What is the benefit of schemas?
Next
From: Doug McNaught
Date:
Subject: Re: php 4.2 postgresql 7.3 help