(PHP 4 >= 4.0.4, PHP 5, PHP 7)
get_defined_functions — 返回所有已定义函数的数组
$exclude_disabled = FALSE
] )获取所有已定义函数的数组。
exclude_disabled禁用的函数是否应该在返回的数据里排除。
返回数组,包含了所有已定义的函数,包括内置(internal) 和用户定义的函数。 可通过$arr["internal"]来访问系统内置函数, 通过$arr["user"]来访问用户自定义函数 (参见示例)。
| 版本 | 说明 |
|---|---|
| PHP 7.0.15, PHP 7.1.1 |
增加 exclude_disabled 参数。
|
Example #1 get_defined_functions() 例子
<?php
function myrow($id, $data)
{
return "<tr><th>$id</th><td>$data</td></tr>\n";
}
$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
)
)