PostgreSQL 9.0 introduced a new hexadecimal-based representation for bytea data that is preferred over the escaping mechanism implemented by this function.
<?php
function pg_escape_byteahex($binary)
{
return "E'\\\\x".bin2hex($binary)."'";
}
?>