Php 如何打印所有已定义函数的数组?

Php 如何打印所有已定义函数的数组?,php,Php,如何打印所有已定义函数的数组? 有时候一个非常复杂的php包含很多其他文件,它有很多常用的函数,比如zencart页面,我想找到页面的所有函数,怎么办 <?php function hello(){} function world(){} // how to print all user defined functions? array( [0] => hello [1] => world ) 您正在寻找get_defined_函数。您可以在php.n

如何打印所有已定义函数的数组? 有时候一个非常复杂的php包含很多其他文件,它有很多常用的函数,比如zencart页面,我想找到页面的所有函数,怎么办

<?php 

function hello(){}
function world(){}


// how to print all user defined functions?
array(
    [0] => hello
    [1] => world
)

您正在寻找get_defined_函数。您可以在php.net上阅读更多关于它的信息

来自php.net上的示例


您可以按如下方式打印定义的函数:

$arr = get_defined_functions();

print_r($arr);
文档

和的可能副本
Array
(
    [internal] => Array
        (
            [0] => zend_version
            [1] => func_num_args
            [2] => func_get_arg
            [3] => func_get_args
            [4] => strlen
            [5] => strcmp
            [6] => strncmp
            ...
            [750] => bcscale
            [751] => bccomp
        )

    [user] => Array
        (
            [0] => myrow
        )

)
$arr = get_defined_functions();

print_r($arr);
<?php
$functions = get_defined_functions();

$user_defined_functions = $functions["user"];
var_dump($user_defined_functions);
?>