In PHP, get_included_files()
returns an array with the names of included files.
In a similar fashion, is there any way to get an array with the names of called functions with parameters?
In PHP, a function is declared with the function keyword prefixed with the function name and the calling of a function in a program is done by just calling the name of the function wherever required.
PHP function is a piece of code that can be reused many times. It can take input as argument list and return value. There are thousands of built-in functions in PHP. In PHP, we can define Conditional function, Function within Function and Recursive function also.
How Many Functions Are in PHP? PHP has over 700 functions you can use for various tasks.
To get the number of arguments that were passed into your function, call func_num_args() and read its return value. To get the value of an individual parameter, use func_get_arg() and pass in the parameter number you want to retrieve to have its value returned back to you.
In this way, Is any way to get an array with the names of called functions with parameters?
No.
What you can do is a debug_backtrace()
which will show all the function calls (with parameters) that lead to the execution of the line you are doing the backtrace from (the "call stack"), but that's different from all functions that were ever called in the script.
What do you want to do? Maybe there's a different approach.
I was searching for something similar and found xdebug's tracing very useful.
Here's an example of how it could look like: http://devzone.zend.com/1135/tracing-php-applications-with-xdebug/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With