public static function toArray(array $arr, $level = 0)
    {
        foreach ($arr as $k => $v) {
            $arr[$k] = (is_array($v) ? self::toArray($v, 1) : '"' . addcslashes($v, '"\\') . '"');
        }

        if ($level === 0) {
            return "'" . pg_escape_string("{" . join(',', $arr) . "}") . "'";
        } else {
            return pg_escape_string("{" . join(',', $arr) . "}");
        }
    }
public static function toArray(array $arr, $level = 0)
    {
        foreach ($arr as $k => $v) {
            $arr[$k] = (is_array($v) ? self::toArray($v, 1) : '"' . addcslashes($v, '"\\') . '"');
        }

        if ($level === 0) {
            return "'" . pg_escape_string("{" . join(',', $arr) . "}") . "'";
        } else {
            return pg_escape_string("{" . join(',', $arr) . "}");
        }
    }
public static function toArray ( array $ arr , $ level = 0 ) { foreach ( $ arr as $ k => $ v ) { $ arr [ $ k ] = ( is_array ( $ v ) ? self :: toArray ( $ v , 1 ) : '"' . addcslashes ( $ v , '"\\' ) . '"' ) ; } if ( $ level === 0 ) { return "'" . pg_escape_string ( "{" . join ( ',' , $ arr ) . "}" ) . "'" ; } else { return pg_escape_string ( "{" . join ( ',' , $ arr ) . "}" ) ; } }
Convert php array to pg array

@param array $arr
@param int $level
@return string
Convert php array to pg array