Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: phpversion - Manual
[go: Go Back, main page]

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

search for in the

putenv" width="11" height="7"/> <phpinfo
Last updated: Mon, 05 Feb 2007
view this page in

phpversion

(PHP 4, PHP 5)

phpversion — 現在のPHPバージョンを取得する

説明

string phpversion ( [string extension] )

現在動作中の PHP パーサのバージョンを表す文字列を返します。 オプションの extension パラメータが 指定されている場合、phpversion() はその拡張モジュールの バージョンを返します。関連するバージョン情報が存在しない場合、あるいは 拡張モジュールが有効でない場合は FALSE を返します。

注意: この情報は、定義済みの定数 PHP_VERSION でも 取得可能です。

例 1740. phpversion()の例

<?php
// たとえば 'Current PHP version: 4.1.1' などと表示する
echo 'Current PHP version: ' . phpversion();

// たとえば '2.0' などと表示する。拡張モジュールが有効でない場合は何も表示しない
echo phpversion('tidy');
?>

version_compare(), phpinfo(), phpcredits(), php_logo_guid(), zend_version() も参照ください。



add a note add a note User Contributed Notes
phpversion
georgemoney dot php at gmail dot com
24-Nov-2006 12:33
some nice little functions to tell the php version number
<?php
function phpnum() {
$version = explode('.', phpversion());
return (int)
$version[0];
}
function
is_php5() { return phpnum() == 5; }
function
is_php4() { return phpnum() == 4; }
?>

Here are some examples of why this comes in handy:

<?php
if(is_php5()) {
class
MyClass {
public function __construct() {
//foo
}
}
} else {
class
MyClass {
function
MyClass() {
//foo
}
}
}
?>

putenv" width="11" height="7"/> <phpinfo
Last updated: Mon, 05 Feb 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites