This article mainly introduces the usage of get_defined_constants function in PHP, and analyzes the function, definition and use skill of get_defined_constants function, and the friend can refer to the following
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.
<?phpdefine ("My_constant", 1);p Rint_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] [e_core_warning] = [E_compile_error] = [e_compile_warning] = [E_user_error] = [e_user_warning] [E_user_notice] = [E_all] = 2047 [TRUE] + 1) [pcre] = = Array ([ Preg_pattern_order] = 1 [Preg_set_order] = 2 [preg_offset_capture] [Preg_split_no_empty] + 1 [preg_split_delim_capture] = 2 [Preg_split_offset_capture] = 4 [Preg_grep_invert] + 1 ) [User] = Array ([my_constant] = 1))