Alex Rivera | Logout

Function list of php file

Asked 2010-02-04T06:44:52.140
16

How to get list of functions that are declared in a php file

Edit
Report

2 Answers

12

You can use get_defined_functions() before and after you include the file, and look at what gets added to the array the second time. Since they appear to be in order of definition, you can just use the index like this:

  $functions = get_defined_functions();
  $last_index = array_pop(array_keys($functions['user']));
  // Include your file here.
  $functions = get_defined_functions();
  $new_functions = array_slice($functions['user'], $last_index);
answered 2012-01-04T14:24:11.460
-1

do include to the file and try this :

$functions = get_defined_functions();
print_r($functions['user']);
answered 2010-02-04T06:49:25.473

Your Answer