defined Checks whether a given named constant exists php函数


defined

(PHP 4, PHP 5)

definedChecks whether a given named constant exists

说明

bool defined ( string $name )

Checks whether the given constant exists and is defined.

Note:

If you want to see if a variable exists, use isset() as defined() only applies to constants. If you want to see if a function exists, use function_exists().

参数

name

The constant name.

返回值

Returns TRUE if the named constant given by name has been defined, FALSE otherwise.

范例

Example #1 Checking Constants

<?php
/* Note the use of quotes, this is important.  This example is checking
 * if the string 'TEST' is the name of a constant named TEST */
if (defined('TEST')) {
    echo 
TEST;
}
?>

参见



相关阅读:
define_syslog_variables Initializes all syslog related variables
deg2rad 将角度转换为弧度
delete 参见 unlink 或 unset
dgettext Override the current domain
die 等同于 exit
dirname 返回路径中的目录部分
diskfreespace disk_free_space 的别名
disk_free_space 返回目录中的可用空间
disk_total_space 返回一个目录的磁盘总大小
dl Loads a PHP extension at runtime
dngettext Plural version of dgettext
dns_check_record 别名 checkdnsrr
dns_get_mx 别名 getmxrr
dns_get_record Fetch DNS Resource Records associated with a hostname
快速导航

Copyright © 2016 phpStudy |