PHP.nl

pg_port

pg_port

Return the port number associated with the connection

string **pg_port**  $connection
returns the port number that the

given PostgreSQL instance is connected to. pg_port``connection

connection

A containing the port number of the database server the is to, or empty string on error. string``connection

Voorbeeld: example

<?php
$pgsql_conn = pg_connect("dbname=mark host=localhost");

if ($pgsql_conn) {
   print "Successfully connected to port: " . pg_port($pgsql_conn) . "<br/>\n";
} else {
   print pg_last_error($pgsql_conn);
   exit;
}
?>