The get_defined_functions() function is an inbuilt function in PHP which returns the all defined functions in the array format.
Syntax:
array get_defined_functions( bool $exclude_disabled = true )
Parameters: This function accepts one parameter that is described below:
- $exclude_disabled: It will check whether the disabled functions will be excluded from the return value i.e. if the function is false, it returns a value otherwise it will return the full definition of the function.
Return value: The return value will be a multidimensional array that has the list of all defined functions(ie., both built-in and user-defined). This function returns a definition of the function or returns the value of the function if the parameter will be true.
Example 1: In this example, we demonstrated the get_defined_functions() function.
PHP
<?php     function hello_world(){         echo "neveropen";     }     $arr = get_defined_functions();             print_r($arr); ?> |
Output:
Array
(
  [internal] => Array
    (
      [0] => zend_version
      [1] => func_num_args
      [2] => func_get_arg
      [3] => func_get_args
      [4] => strlen
      [5] => strcmp
      [6] => strncmp
      [7] => strcasecmp
      [8] => strncasecmp
      [9] => error_reporting
      [10] => define
      [11] => defined
} Â Â [user] => Array
    (
      [0] => hello_world
    ) )
Â
Example 2: In this example, we will print only user-defined functions in an array form.
PHP
<?php     function hello_world(){         echo "neveropen";     }     function bye_gfg(){         echo "Bye neveropen" ;     }     $arr = get_defined_functions();             print_r($arr["user"]); ?> |
Output:
Array
(
  [0] => hello_world
  [1] => bye_gfg
)
Reference: https://www.php.net/manual/en/function.get-defined-functions.php
