Get a called functions list in PHP -
in php, get_included_files()
returns array names of included files.
in similar fashion, there way array names of called functions parameters?
i trying achieve want , came reasonable solution.
make class named debug
, include above every file want debug in. build function prints nicely information stored in $calls
.
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); } }
call function everytime declare function first line in functionbody: debug::log($message(optional) )
Comments
Post a Comment