A
A
Andrey05022018-07-17 18:31:59
PHP
Andrey0502, 2018-07-17 18:31:59

Parsing methods in classes, PHP?

Need to parse n number of php files with classes, getting the names of public methods
Help me write a regular expression
so that from this:

class Text
{
public function getName(...)
{
return $name;
}
public static function export(...)
{
return 'alalla';
}
}

Got an array:
$array = [
"getName",  "static export"
];

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maksim Fedorov, 2018-07-17
@Maksclub

php.net/manual/ru/reflectionclass.getmethods.php
Well, you will bring the resulting array to your own form in trivial ways.
The main thing is that regular expressions are not needed here :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question