Is there any way to dump a user defined or system compiled function same as print_r
or var_dump
for variables in PHP?
for example:
dump('echo');
or
dump('my_function');
Is there any way to dump a user defined or system compiled function same as print_r
or var_dump
for variables in PHP?
for example:
dump('echo');
or
dump('my_function');
Such a function would be powerful.
Some tools outside of PHP will help: A debugger, like gdb; a refactoring tool, like resharper/MonoDev and some tracing tools, like strace/dtrace. You would also use some tools, which expose internals, like Derick's VLD or PVT, which can dump the opcodes to a readable format, from there, it's not totally impossible to (re)create the code from it.
Especially, in regard to commercial PHP extensions and products, like Zend Core/Platform or Zend Server it would be a reverse engineering / disassembling technique, because you are asking for C/C++ extension code from inside PHP.
You ain't gonna need this technique!
The benefit of doing this is some frameworks such as Zend extend some function to PHP global functions such as zend_report_statistics and I want to see their structures in my debug pages because they compiled in dll files.
There is no real benefit, except debugging, in seeing the interals of a little stats reporting function.
And by the way, the first thing you would see, when doing a dump('echo');
is, that echo
is a language construct and not a function.