Function list of php file

前端 未结 12 1317
南方客
南方客 2020-11-28 14:40

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

12条回答
  •  没有蜡笔的小新
    2020-11-28 15:08

    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);
    

提交回复
热议问题