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

search for in the

putenv> <phpinfo
Last updated: Fri, 27 Jun 2008

view this page in

phpversion

(PHP 4, PHP 5)

phpversion — Restituisce la versione del PHP

Descrizione

string phpversion ( void )

Restituisce una stringa contenente la versione dell'interprete PHP.

Nota: Questa informazione è anche disponibile come costante predefinita PHP_VERSION.

Example #1 Esempio di uso di phpversion()

<?php
// Ad esempio visualizza 'Current PHP version: 4.1.1'
echo 'Current PHP version: ' phpversion();
?>

Vedere anche version_compare(), phpinfo(), phpcredits(), php_logo_guid() e zend_version().



add a note add a note User Contributed Notes
phpversion
djtopper at email dot cz
14-Apr-2008 12:57
Real PHP version:
$phpversion = preg_replace('/[a-z-]/', '', phpversion());
kalle at php dot net
10-Jan-2008 07:21
On some machines phpversion() will not return a string in this format:
major.minor.version

But rather
major.minor.version-[os manufacturer]

I experinced this on a couple of Linux variants like Ubuntu.

So don't rely on the first format, I made this function to get the "real" version which might come in handy if you don't want the 'os manufacturer' part:

<?php
   
function phpversion_real()
    {
       
$v = phpversion();
       
$version = Array();

        foreach(
explode('.', $v) as $bit)
        {
            if(
is_numeric($bit))
            {
               
$version[] = $bit;
            }
        }

        return(
implode('.', $version));
    }
?>

putenv> <phpinfo
Last updated: Fri, 27 Jun 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites