Answer the question
In order to leave comments, you need to log in
How to find the location of a function definition in PHP?
Conditions:
1) remote host with ssh access;
2) a lot of files, downloading them is not an option.
get_defined_functions () says that the function is defined, the interpreter does not swear at its call.
How to find where a function is defined?
Tried the following:
grep --include="*.php" -r -l "function foo_bar(" ./
Answer the question
In order to leave comments, you need to log in
<?php
function test() {
}
$ref = new ReflectionFunction('test');
echo $ref->getFileName().':'.$ref->getStartLine().PHP_EOL;
I thought that in the regex, the opening bracket would be a service character
grep -riP 'function\s+foo_bar\s*\(' --include="*.php" ./
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question