(PHP 5, PHP 7, PHP 8)
pg_version — Returns an array with client, protocol and server version (when available)
pg_version() returns an array with the client, protocol and server version. Protocol and server versions are only available if PHP was compiled with PostgreSQL 7.4 or later.
For more detailed server information, use pg_parameter_status().
connection
Примірник
PgSql\Connection. Якщо параметр
connection
— null
, то виконується стандартне
з'єднання, тобто останнє, виконане функцією pg_connect()
або pg_pconnect().
Починаючи з PHP 8.1.0, використання стандартного з'єднання є застарілим.
Returns an array with client
, protocol
and server
keys and values (if available).
Версія | Опис |
---|---|
8.1.0 |
Тепер параметр connection має бути примірником
PgSql\Connection. Раніше очікувався resource.
|
8.0.0 |
connection is now nullable.
|
Приклад #1 pg_version() example
<?php
$dbconn = pg_connect("host=localhost port=5432 dbname=mary")
or die("Could not connect");
$v = pg_version($dbconn);
echo $v['client'];
?>
Поданий вище приклад виведе:
7.4