(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
pg_connection_status — Lit le statut de la connexion PostgreSQL
   pg_connection_status() retourne le statut de la
   connexion connection.
  
    PGSQL_CONNECTION_OK ou 
    PGSQL_CONNECTION_BAD.
   
| Version | Description | 
|---|---|
| 8.1.0 | Le paramètre connectionattend désormais une instance de
  PgSql\Connection ; auparavant, une ressource était attendu. | 
Exemple #1 Exemple avec pg_connection_status()
<?php
  $dbconn = pg_connect("dbname=publisher") or die("Connexion impossible");
  $stat = pg_connection_status($dbconn);
  if ($stat === PGSQL_CONNECTION_OK) {
      echo 'Connexion ok';
  } else {
      echo 'Connexion erronée';
  } 
?>