Real PHP version:
$phpversion = preg_replace('/[a-z-]/', '', phpversion());
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().
phpversion
djtopper at email dot cz
14-Apr-2008 12:57
14-Apr-2008 12:57
kalle at php dot net
10-Jan-2008 07:21
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));
}
?>
