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/ro/function.phpversion.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/ref.info.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'ro',
  ),
 
'this' =>
  array (
   
0 => 'function.phpversion.php',
   
1 => 'phpversion',
  ),
 
'up' =>
  array (
   
0 => 'ref.info.php',
   
1 => 'Funcții pentru opțiuni/informații PHP',
  ),
 
'prev' =>
  array (
   
0 => 'function.phpinfo.php',
   
1 => 'phpinfo',
  ),
 
'next' =>
  array (
   
0 => 'function.putenv.php',
   
1 => 'putenv',
  ),
 
'alternatives' =>
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.phpversion" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">phpversion</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">phpversion</span> &mdash; <span class="dc-title">Gets the current PHP version</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.phpversion-description">
  <h3 class="title">Descrierea</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><strong>phpversion</strong></span>
    ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$extension</code></span>
  ] )</div>

  <p class="para rdfs-comment">
   Returns a string containing the version of the currently running PHP
   parser or extension.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.phpversion-parameters">
  <h3 class="title">Parametri</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">extension</code></em></span>
     <dd>

      <p class="para">
       An optional extension name.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.phpversion-returnvalues">
  <h3 class="title">Valorile întoarse</h3>
  <p class="para">
   If the optional <em><code class="parameter">extension</code></em> parameter is
   specified,  <span class="function"><strong>phpversion()</strong></span> returns the version of that
   extension, or <strong><code>FALSE</code></strong> if there is no version information associated or
   the extension isn&#039;t enabled.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.phpversion-examples">
  <h3 class="title">Exemple</h3>
  <p class="para">
   <div class="example" id="example-508">
    <p><strong>Example #1  <span class="function"><strong>phpversion()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;prints&nbsp;e.g.&nbsp;'Current&nbsp;PHP&nbsp;version:&nbsp;4.1.1'<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">'Current&nbsp;PHP&nbsp;version:&nbsp;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">phpversion</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">//&nbsp;prints&nbsp;e.g.&nbsp;'2.0'&nbsp;or&nbsp;nothing&nbsp;if&nbsp;the&nbsp;extension&nbsp;isn't&nbsp;enabled<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">phpversion</span><span style="color: #007700">(</span><span style="color: #DD0000">'tidy'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
  <p class="para">
   <div class="example" id="example-509">
    <p><strong>Example #2 <strong><code>PHP_VERSION_ID</code></strong> example and usage</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;PHP_VERSION_ID&nbsp;is&nbsp;available&nbsp;as&nbsp;of&nbsp;PHP&nbsp;5.2.7,&nbsp;if&nbsp;our&nbsp;<br />//&nbsp;version&nbsp;is&nbsp;lower&nbsp;than&nbsp;that,&nbsp;then&nbsp;emulate&nbsp;it<br /></span><span style="color: #007700">if&nbsp;(!</span><span style="color: #0000BB">defined</span><span style="color: #007700">(</span><span style="color: #DD0000">'PHP_VERSION_ID'</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$version&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">explode</span><span style="color: #007700">(</span><span style="color: #DD0000">'.'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">PHP_VERSION</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">define</span><span style="color: #007700">(</span><span style="color: #DD0000">'PHP_VERSION_ID'</span><span style="color: #007700">,&nbsp;(</span><span style="color: #0000BB">$version</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">]&nbsp;*&nbsp;</span><span style="color: #0000BB">10000&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">$version</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">]&nbsp;*&nbsp;</span><span style="color: #0000BB">100&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">$version</span><span style="color: #007700">[</span><span style="color: #0000BB">2</span><span style="color: #007700">]));<br />}<br /><br /></span><span style="color: #FF8000">//&nbsp;PHP_VERSION_ID&nbsp;is&nbsp;defined&nbsp;as&nbsp;a&nbsp;number,&nbsp;where&nbsp;the&nbsp;higher&nbsp;the&nbsp;number&nbsp;<br />//&nbsp;is,&nbsp;the&nbsp;newer&nbsp;a&nbsp;PHP&nbsp;version&nbsp;is&nbsp;used.&nbsp;It's&nbsp;defined&nbsp;as&nbsp;used&nbsp;in&nbsp;the&nbsp;above&nbsp;<br />//&nbsp;expression:<br />//<br />//&nbsp;$version_id&nbsp;=&nbsp;$major_version&nbsp;*&nbsp;10000&nbsp;+&nbsp;$minor_version&nbsp;*&nbsp;100&nbsp;+&nbsp;$release_version;<br />//<br />//&nbsp;Now&nbsp;with&nbsp;PHP_VERSION_ID&nbsp;we&nbsp;can&nbsp;check&nbsp;for&nbsp;features&nbsp;this&nbsp;PHP&nbsp;version&nbsp;<br />//&nbsp;may&nbsp;have,&nbsp;this&nbsp;doesn't&nbsp;require&nbsp;to&nbsp;use&nbsp;version_compare()&nbsp;everytime&nbsp;<br />//&nbsp;you&nbsp;check&nbsp;if&nbsp;the&nbsp;current&nbsp;PHP&nbsp;version&nbsp;may&nbsp;not&nbsp;support&nbsp;a&nbsp;feature.<br />//<br />//&nbsp;For&nbsp;example,&nbsp;we&nbsp;may&nbsp;here&nbsp;define&nbsp;the&nbsp;PHP_VERSION_*&nbsp;constants&nbsp;thats&nbsp;<br />//&nbsp;not&nbsp;available&nbsp;in&nbsp;versions&nbsp;prior&nbsp;to&nbsp;5.2.7<br /><br /></span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">PHP_VERSION_ID&nbsp;</span><span style="color: #007700">&lt;&nbsp;</span><span style="color: #0000BB">50207</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">define</span><span style="color: #007700">(</span><span style="color: #DD0000">'PHP_MAJOR_VERSION'</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$version</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">]);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">define</span><span style="color: #007700">(</span><span style="color: #DD0000">'PHP_MINOR_VERSION'</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$version</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">]);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">define</span><span style="color: #007700">(</span><span style="color: #DD0000">'PHP_RELEASE_VERSION'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$version</span><span style="color: #007700">[</span><span style="color: #0000BB">2</span><span style="color: #007700">]);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;and&nbsp;so&nbsp;on,&nbsp;...<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.phpversion-notes">
  <h3 class="title">Note</h3>
  <blockquote class="note"><p><strong class="note">Notă</strong>:
   <p class="para">
    This information is also available in the predefined constant
    <strong><code>PHP_VERSION</code></strong>. More versioning information
    is available using the <strong><code>PHP_VERSION_*</code></strong>
    constants.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.phpversion-seealso">
  <h3 class="title">Vedeți de asemenea</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><a href="reserved.constants.php#reserved.constants.core" class="link">PHP_VERSION constants</a></li>
    <li class="member"> <span class="function"><a href="function.version-compare.php" class="function" rel="rdfs-seeAlso">version_compare()</a> - Compares two &quot;PHP-standardized&quot; version number strings</span></li>
    <li class="member"> <span class="function"><a href="function.phpinfo.php" class="function" rel="rdfs-seeAlso">phpinfo()</a> - Outputs information about PHP's configuration</span></li>
    <li class="member"> <span class="function"><a href="function.phpcredits.php" class="function" rel="rdfs-seeAlso">phpcredits()</a> - Prints out the credits for PHP</span></li>
    <li class="member"> <span class="function"><a href="function.php-logo-guid.php" class="function" rel="rdfs-seeAlso">php_logo_guid()</a> - Gets the logo guid</span></li>
    <li class="member"> <span class="function"><a href="function.zend-version.php" class="function" rel="rdfs-seeAlso">zend_version()</a> - Gets the version of the current Zend engine</span></li>
   </ul>
  </p>
 </div>


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