Hello,
I am familiar with the get_defined_functions() function as a way of listing all of the user defined functions.
Is there a way with PHP to also determine from which file the user function was defined?
Consider the following example. Assume there are three files:
- index.php
- user_functions1.inc.php
- user_functions2.inc.php
contents of user_functions1.inc.php:
<?php
function example_function1() {
print "hello world 1";
}
?>
contents of user_functions2.inc.php:
<?php
function example_function2() {
print "hello world 2";
}
?>
contents of index.php:
<?php
include(user_functions1.inc.php);
include(user_functions2.inc.php);
$functions = get_defined_functions();
$user_functions = $functions['user'];
foreach($user_functions as $function) {
print "$function<br>";
}
?>
output of index.php:
example_function1
example_function2
I would like to use PHP to determine that user function example_function1 was defined in the file user_functions1.inc.php
Is this possible?
Thank you.
Dave