An example analysis of get_defined_constants function usage in PHP
This example describes the use of get_defined_constants functions in PHP. Share to everyone for your reference. The specific analysis is as follows:
Get_defined_constants (php 4 > = 4.1.0, php 5)
Get_defined_constants-Returns an associative array of names of all constants and their values
Describe
Array Get_defined_constants ([Boolean $ collation])
Returns all currently defined constants for the name and value. This includes the established extension and the Define () function that was created.
Parameters
Classification
This function returns the second aspect of the first and the constants and their values in the multidimensional array category.
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21st 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 would 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 ) ) |
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/1000110.html www.bkjia.com true http://www.bkjia.com/PHPjc/1000110.html techarticle Example analysis of get_defined_constants function usage in PHP This article describes the use of get_defined_constants functions in PHP. Share to everyone for your reference. The specific analysis is as follows: Get_define ...