How can I extract all function names from a PHP file?
The file has many functions that look more or less like the following. Is a regular expression the best way to
If the PHP file is syntactically correct and only contains function only, you can store the result of get_defined_functions into an array (anyway, is return an array).
include_once the PHP file, compare the latest get_defined_functions with the previous array (like array_diff). Whichever results returned by array_diff are the functions define in the PHP file.
If is an object declaration, the above won't work, although you can make use of function get_class_method, but it is not able to return protected and private methods.
OR
ob_start();
highlight_string(file_get_contents('class.php'));
$html = ob_get_contents();
ob_end_clean();
$dom = new DomDocument;
$dom->loadHTML($html);
You can have a list of DOM with a style attribute you can filter with.