Thread: 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
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