Home  >  Article  >  Daily Programming  >  How to get the function name of a module in PHP

How to get the function name of a module in PHP

藏色散人
藏色散人Original
2019-02-16 14:44:097414browse

PHP obtains the function name of the module, which can be achieved through the get_extension_funcs function. Such as searching XML, JSON functions.

How to get the function name of a module in PHP

Let’s use code examples to introduce how to get module function names in PHP.

The code example is as follows:

<?php
echo "<pre class="brush:php;toolbar:false">";
print_r(get_extension_funcs("JSON"));
echo "<br>";
print_r(get_extension_funcs("XML"))."\n";

The output result is as follows:

Array
(
    [0] => json_encode
    [1] => json_decode
    [2] => json_last_error
    [3] => json_last_error_msg
)
Array
(
    [0] => xml_parser_create
    [1] => xml_parser_create_ns
    [2] => xml_set_object
    [3] => xml_set_element_handler
    [4] => xml_set_character_data_handler
    [5] => xml_set_processing_instruction_handler
    [6] => xml_set_default_handler
    [7] => xml_set_unparsed_entity_decl_handler
    [8] => xml_set_notation_decl_handler
    [9] => xml_set_external_entity_ref_handler
    [10] => xml_set_start_namespace_decl_handler
    [11] => xml_set_end_namespace_decl_handler
    [12] => xml_parse
    [13] => xml_parse_into_struct
    [14] => xml_get_error_code
    [15] => xml_error_string
    [16] => xml_get_current_line_number
    [17] => xml_get_current_column_number
    [18] => xml_get_current_byte_index
    [19] => xml_parser_free
    [20] => xml_parser_set_option
    [21] => xml_parser_get_option
    [22] => utf8_encode
    [23] => utf8_decode
)

Function introduction:

get_extension_funcs() function , returns an array of module function names.

array get_extension_funcs ( string $module_name )

This function returns the names of all functions defined within the module based on module_name.

The parameter module_name is the module name.

Note: This parameter must be lowercase (lowercase).

Return value, returns an array containing all function names, or returns FALSE if module_name is not a valid extension.

This article is an introduction to how to obtain the module function name in PHP. It is simple and easy to understand. I hope it will be helpful to friends in need!

The above is the detailed content of How to get the function name of a module in PHP. For more information, please follow other related articles on the PHP Chinese website!

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