It is easy.

Manual http://www.postgresql.org/docs/9.2/static/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-ESCAPE

Implementation https://github.com/milo/utils/blob/master/Utils/PgsqlArray.php#L193 (The letter `E` on the begining is optional, see http://www.postgresql.org/docs/9.2/static/runtime-config-compatible.html#GUC-ESCAPE-STRING-WARNING)