phpversion

(PHP 4, PHP 5, PHP 7)

phpversionRestituisce 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 3 notes

up
57
cHao
3 years ago
If you're trying to check whether the version of PHP you're running on is sufficient, don't screw around with `strcasecmp` etc.  PHP already has a `version_compare` function, and it's specifically made to compare PHP-style version strings.

<?php
if (version_compare(phpversion(), '5.3.10', '<')) {
   
// php version isn't high enough
}
?>
up
10
pavankumar at tutorvista dot com
5 years ago
To know, what are the {php} extensions loaded & version of extensions :

<?php
foreach (get_loaded_extensions() as $i => $ext)
{
   echo
$ext .' => '. phpversion($ext). '<br/>';
}
?>
up
0
burninleo at gmx dot net
15 days ago
Note that the version string returned by phpversion() may include more information than expected: "5.5.9-1ubuntu4.17", for example.
To Top