首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

get_defined_functions

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

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

描述

代码语言:javascript
复制
array get_defined_functions ([ bool $exclude_disabled = FALSE ] )

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

参数

exclude_disabled

是否应该从返回值中排除禁用的函数。

返回值

返回包含所有已定义函数(内置(内部)和用户定义的函数)的多维数组。内部函数可以通过 $ arr“internal” 访问,用户可以使用 $ arr“user” 定义内部函数。

更新日志

Version

Description

PHP 7.0.15, PHP 7.1.1

The exclude_disabled parameter has been added.

例子

示例#1 get_defined_functions()示例

代码语言:javascript
复制
<?php
function?myrow($id,?$data)
{
????return?"<tr><th>$id</th><td>$data</td></tr>\n";
}

$arr?=?get_defined_functions();

print_r($arr);
?>

上面的例子会输出类似于:

代码语言:javascript
复制
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
        )

)

请参阅

  • function_exists() - 如果已定义给定函数,则返回TRUE
  • get_defined_vars() - 返回所有已定义变量的数组
  • get_defined_constants() - 返回一个包含所有常量及其值的名称的关联数组
  • get_declared_classes() - 返回一个具有定义类名称的数组

← function_exists

register_shutdown_function →

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com