0
Example:
index php.
<?php foo(); bar(); print_r(getCalledFunctions(__FILE__));
Print:
array
0 => 'foo'
1 => 'bar'
Question:
Can someone return me the getCalledFunctions function?
0
Example:
index php.
<?php
foo();
bar();
print_r(getCalledFunctions(__FILE__));
Print:
array
0 => 'foo'
1 => 'bar'
Question:
Can someone return me the getCalledFunctions function?
1
A demonstrated reasonable solution in this answer Stack Overflow creates a class called Debug
and include it above any file you want to debug.
class Debug {
private static $calls;
public static function log($message = null)
{
if(!is_array(self::$calls))
self::$calls = array();
$call = debug_backtrace(false);
$call = (isset($call[1]))?$call[1]:$call[0];
$call['message'] = $message;
array_push(self::$calls, $call);
}
}
Invoke the method Debug::log() whenever you need in the first line of the body of your functions.
And finally print as you wish the property information Debug::calls.
Putz... I’ll have to put in all the functions???
Browser other questions tagged php function
You are not signed in. Login or sign up in order to post.
Is that a question? I don’t understand...
– Jorge B.
Yes, I want the getCalledFunctions function...
– Slowaways
Ah... I don’t think there’s any way to do that. At least that reminds me.
– Jorge B.
He’s got it in the Stackoverflow community in English, I just don’t know if it’s what he’s looking for. http://stackoverflow.com/questions/3881588/get-a-called-functions-list-in-php
– Hiago Souza