downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the Git repository for this website on git.php.net.

Source of: /manual/fa/function.pg-version.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/ref.pgsql.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'fa',
  ),
 
'this' =>
  array (
   
0 => 'function.pg-version.php',
   
1 => 'pg_version',
  ),
 
'up' =>
  array (
   
0 => 'ref.pgsql.php',
   
1 => 'PostgreSQL Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.pg-update.php',
   
1 => 'pg_update',
  ),
 
'next' =>
  array (
   
0 => 'book.sqlite.php',
   
1 => 'SQLite',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.pg-version" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">pg_version</h1>
  <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">pg_version</span> &mdash; <span class="dc-title">
   Returns an array with client, protocol and server version (when available)
  </span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.pg-version-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">array</span> <span class="methodname"><b>pg_version</b></span>
    ([ <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$connection</tt></span>
  ] )</div>

  <p class="para rdfs-comment">
   <span class="function"><b>pg_version()</b></span> 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.
  </p>
  <p class="para">
   For more detailed server information, use <span class="function"><a href="function.pg-parameter-status.php" class="function">pg_parameter_status()</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.pg-version-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><i><tt class="parameter">connection</tt></i></span>
     <dd>

      <p class="para">
       PostgreSQL database connection resource.  When
       <i><tt class="parameter">connection</tt></i> is not present, the default connection
       is used. The default connection is the last connection made by
       <span class="function"><a href="function.pg-connect.php" class="function">pg_connect()</a></span> or <span class="function"><a href="function.pg-pconnect.php" class="function">pg_pconnect()</a></span>.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.pg-version-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns an array with <i>client</i>, <i>protocol</i>
   and <i>server</i> keys and values (if available).  Returns
   <b><tt>FALSE</tt></b> on error or invalid connection.
  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-function.pg-version-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1793">
    <p><b>Example #1 <span class="function"><b>pg_version()</b></span> example</b></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />&nbsp;&nbsp;$dbconn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">pg_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"host=localhost&nbsp;port=5432&nbsp;dbname=mary"</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or&nbsp;die(</span><span style="color: #DD0000">"Could&nbsp;not&nbsp;connect"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$v&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">pg_version</span><span style="color: #007700">(</span><span style="color: #0000BB">$dbconn</span><span style="color: #007700">);<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$v</span><span style="color: #007700">[</span><span style="color: #DD0000">'client'</span><span style="color: #007700">];<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>The above example will output:</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
7.4
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.pg-version-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.pg-parameter-status.php" class="function" rel="rdfs-seeAlso">pg_parameter_status()</a> - Looks up a current parameter setting of the server.</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites