Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out where a function is defined?

Tags:

php

How can I find out in which file and line a given function was defined?

like image 340
foreline Avatar asked Feb 08 '10 14:02

foreline


People also ask

How do you find a function is defined?

A function is a relation for which each value from the set the first components of the ordered pairs is associated with exactly one value from the set of second components of the ordered pair.

How do I know what the domain of a function is?

The domain of a function is the set of all possible inputs for the function. For example, the domain of f(x)=x² is all real numbers, and the domain of g(x)=1/x is all real numbers except for x=0. We can also define special functions whose domains are more limited.

How do you find where a function is not defined?

A function is not defined or is undefined if the value to be inputted is not in its domain. For instance, the domain of the function f(x)=√x f ( x ) = x is x≥0 x ≥ 0 .


2 Answers

You could also do this in PHP itself:

$reflFunc = new ReflectionFunction('function_name'); print $reflFunc->getFileName() . ':' . $reflFunc->getStartLine(); 
like image 177
Tom Haigh Avatar answered Sep 28 '22 01:09

Tom Haigh


Either use a IDE that allows doing so (I would recomend Eclipse PDT), or you can allways grep it if on Linux, or using wingrep. In Linux it would be something like:

grep -R "function funName" * 

from within the root folder of the project.

like image 42
Johnco Avatar answered Sep 28 '22 03:09

Johnco