Home  >  Article  >  Backend Development  >  php中get_defined_constants函数用法实例分析_PHP教程

php中get_defined_constants函数用法实例分析_PHP教程

WBOY
WBOYOriginal
2016-07-13 09:53:36715browse

php中get_defined_constants函数用法实例分析

   本文实例讲述了php中get_defined_constants函数用法。分享给大家供大家参考。具体分析如下:

  get_defined_constants ( PHP 4中 > = 4.1.0 , PHP 5中)

  get_defined_constants -返回一个关联数组的名字所有的常量和他们的价值观

  描述

  阵列get_defined_constants ( [布尔$归类] )

  返回名称和值的所有当前定义的常量。这包括设立的扩展以及创建的define()函数。

  参数

  分类

  造成这个函数返回多维阵列类别中的第一项维和常量和他们的价值观中的第二个方面。

  ?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

define("MY_CONSTANT", 1);

print_r(get_defined_constants(true));

?>

The above example will output something similar to:

Array

(

[internal] => Array

(

[E_ERROR] => 1

[E_WARNING] => 2

[E_PARSE] => 4

[E_NOTICE] => 8

[E_CORE_ERROR] => 16

[E_CORE_WARNING] => 32

[E_COMPILE_ERROR] => 64

[E_COMPILE_WARNING] => 128

[E_USER_ERROR] => 256

[E_USER_WARNING] => 512

[E_USER_NOTICE] => 1024

[E_ALL] => 2047

[TRUE] => 1

)

[pcre] => Array

(

[PREG_PATTERN_ORDER] => 1

[PREG_SET_ORDER] => 2

[PREG_OFFSET_CAPTURE] => 256

[PREG_SPLIT_NO_EMPTY] => 1

[PREG_SPLIT_DELIM_CAPTURE] => 2

[PREG_SPLIT_OFFSET_CAPTURE] => 4

[PREG_GREP_INVERT] => 1

)

[user] => Array

(

[MY_CONSTANT] => 1

)

)

  希望本文所述对大家的php程序设计有所帮助。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1000110.htmlTechArticlephp中get_defined_constants函数用法实例分析 本文实例讲述了php中get_defined_constants函数用法。分享给大家供大家参考。具体分析如下: get_define...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn