get_defined_functions

(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)

get_defined_functions返回所有已定义函数的数组

说明

get_defined_functions(bool$exclude_disabled = true): array

获取所有已定义函数的数组。

参数

exclude_disabled

禁用的函数是否应该在返回的数据里排除。

返回值

返回数组,包含了所有已定义的函数,包括内置/用户定义的函数。可通过 $arr["internal"] 来访问系统内置函数,通过 $arr["user"] 来访问用户自定义函数(参见示例)。

更新日志

版本说明
8.0.0exclude_disabled 参数的默认值从 false 更改为 true
7.0.15, 7.1.1 新增 exclude_disabled 参数。

示例

示例 #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 ) )

参见

To Top